diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4fdba907..afe2d91c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -11,7 +11,7 @@
{{ block "main" . }}{{ end }}
-{{ partialCached "page/footer" . }} +{{ partial "page/footer" . }} {{ partial "scripts/_bundle" . -}} {{ partial "scripts/shortcodes" . -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b8c85b6c..58df516a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,7 @@
- {{ .Date.Format "January 2, 2006" }}{{ with .Site.Params.githubRepo }}Improve This Post{{ end }} + {{ .Date.Format "January 2, 2006" }}{{ with .Scratch.Get "sourceURL" }}Improve This Post{{ end }}

{{ .Title | markdownify }}

diff --git a/layouts/partials/head/canonical.html b/layouts/partials/head/canonical.html index 4b9aeec8..0b32d6d3 100644 --- a/layouts/partials/head/canonical.html +++ b/layouts/partials/head/canonical.html @@ -1,7 +1,19 @@ -{{ if and .IsPage (eq .Type .Site.Params.mainSection) }} + +{{ if and .IsPage (eq .Type .Site.Params.mainSection) -}} {{- with .OutputFormats.Get "amp" -}} - {{ end -}} -{{ end -}} + {{- end -}} +{{- end }} + + +{{/* 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 }} diff --git a/layouts/partials/page/footer.html b/layouts/partials/page/footer.html index 96557e5c..539c595e 100644 --- a/layouts/partials/page/footer.html +++ b/layouts/partials/page/footer.html @@ -3,8 +3,8 @@
Made for Internet Explorer®
- Made with and Hugo. - {{ with .Site.Params.githubRepo }}View source.{{ end }} + Made with and Hugo. + {{ with .Scratch.Get "sourceURL" }}View source.{{ end }}