1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-20 20:41:16 -04:00

link View Source in page/post footers to specific file on GitHub

This commit is contained in:
2020-06-26 12:59:46 -04:00
parent f3198e0235
commit 45b23c45a3
4 changed files with 19 additions and 7 deletions

View File

@@ -11,7 +11,7 @@
<div id="wrap"> <div id="wrap">
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</div> </div>
{{ partialCached "page/footer" . }} {{ partial "page/footer" . }}
{{ partial "scripts/_bundle" . -}} {{ partial "scripts/_bundle" . -}}
{{ partial "scripts/shortcodes" . -}} {{ partial "scripts/shortcodes" . -}}
</body> </body>

View File

@@ -2,7 +2,7 @@
<main id="single"> <main id="single">
<article> <article>
<div id="meta"> <div id="meta">
<a class="no-underline" href="{{ .Permalink }}" title="{{ .Date.Format "Mon, Jan 2 2006 3:04:05 PM MST" }}">{{ .Date.Format "January 2, 2006" }}</a>{{ with .Site.Params.githubRepo }}<span class="dash"></span><a class="no-underline" href="https://github.com/{{ . }}/blob/main/content/{{ $.File.Path }}" title="Edit this post on GitHub" target="_blank" rel="noopener">Improve This Post</a>{{ end }} <a class="no-underline" href="{{ .Permalink }}" title="{{ .Date.Format "Mon, Jan 2 2006 3:04:05 PM MST" }}">{{ .Date.Format "January 2, 2006" }}</a>{{ with .Scratch.Get "sourceURL" }}<span class="dash"></span><a class="no-underline" href="{{ . | safeURL }}" title="Edit this post on GitHub" target="_blank" rel="noopener">Improve This Post</a>{{ end }}
</div> </div>
<h1 id="title"><a class="no-underline" href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1> <h1 id="title"><a class="no-underline" href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>

View File

@@ -1,7 +1,19 @@
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
{{ if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{ if and .IsPage (eq .Type .Site.Params.mainSection) -}}
{{- with .OutputFormats.Get "amp" -}} {{- with .OutputFormats.Get "amp" -}}
<link rel="amphtml" href="{{ .Permalink }}"> <link rel="amphtml" href="{{ .Permalink }}">
{{ end -}} {{- end -}}
{{ end -}} {{- end }}
<link rel="author" href="{{ "humans.txt" | absURL }}"> <link rel="author" href="{{ "humans.txt" | absURL }}">
{{/* if this is a page/post, link View Source to specific file on GitHub. otherwise, just link to repo homepage. */}}
{{- with .Site.Params.githubRepo }}
{{- $githubURL := printf "https://github.com/%s" . }}
{{- if not $.IsPage }}
{{- $.Scratch.Set "sourceURL" $githubURL }}
{{- else }}
{{- $.Scratch.Set "sourceURL" (printf "%s/blob/main/content/%s" $githubURL $.File.Path) }}
{{- end }}
{{- end }}

View File

@@ -3,8 +3,8 @@
<div id="copyright">Content <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.licenseFull }} title="{{ . }}"{{ end }}>licensed under {{ .Site.Params.license }}</a>, {{ with .Site.Params.copyrightFirstYear }}<a class="no-underline" href="{{ "previously/" | absURL }}" title="Previously on...">{{ . }} &ndash;</a>{{ end }} {{ now.Format "2006" }}.</div> <div id="copyright">Content <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.licenseFull }} title="{{ . }}"{{ end }}>licensed under {{ .Site.Params.license }}</a>, {{ with .Site.Params.copyrightFirstYear }}<a class="no-underline" href="{{ "previously/" | absURL }}" title="Previously on...">{{ . }} &ndash;</a>{{ end }} {{ now.Format "2006" }}.</div>
<div id="y2k"><a class="no-underline" href="https://y2k.land/" title="Made for Internet Explorer&reg;" target="_blank" rel="noopener"><img src="{{ "img/ie.gif" | absURL }}" style="width: 88px; height: 31px;" alt="Made for Internet Explorer&reg;"></a></div> <div id="y2k"><a class="no-underline" href="https://y2k.land/" title="Made for Internet Explorer&reg;" target="_blank" rel="noopener"><img src="{{ "img/ie.gif" | absURL }}" style="width: 88px; height: 31px;" alt="Made for Internet Explorer&reg;"></a></div>
<div id="poweredby"> <div id="poweredby">
<a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Made with <span class="beat">&#x2764;</span> and Hugo.</a> Made with <span class="beat">&#x2764;</span> and <a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Hugo</a>.
{{ with .Site.Params.githubRepo }}<a class="no-underline" href="https://github.com/{{ . }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }} {{ with .Scratch.Get "sourceURL" }}<a class="no-underline" href="{{ . | safeURL }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }}
</div> </div>
</div> </div>
</footer> </footer>