diff --git a/layouts/index.webmanifest b/layouts/index.webmanifest index e0900104..e57011cf 100644 --- a/layouts/index.webmanifest +++ b/layouts/index.webmanifest @@ -1,32 +1,34 @@ { "name": "{{ .Site.Title }}", "short_name": "{{ (urls.Parse .Site.Params.baseURL).Host }}", + {{- with .Site.Data.manifest }} "icons": [ - {{ with index .Site.Data.manifest "images/android-chrome-512x512.png" }}{ + {{ with index . "images/android-chrome-512x512.png" }}{ "src": "{{ .src | absURL | safeJS }}", "sizes": "512x512", "type": "image/png", "purpose": "any" },{{ end }} - {{ with index .Site.Data.manifest "images/android-chrome-192x192.png" }}{ + {{ with index . "images/android-chrome-192x192.png" }}{ "src": "{{ .src | absURL | safeJS }}", "sizes": "192x192", "type": "image/png", "purpose": "any" },{{ end }} - {{ with index .Site.Data.manifest "images/maskable-512x512.png" }}{ + {{ with index . "images/maskable-512x512.png" }}{ "src": "{{ .src | absURL | safeJS }}", "sizes": "512x512", "type": "image/png", "purpose": "maskable" },{{ end }} - {{ with index .Site.Data.manifest "images/maskable-192x192.png" }}{ + {{ with index . "images/maskable-192x192.png" }}{ "src": "{{ .src | absURL | safeJS }}", "sizes": "192x192", "type": "image/png", "purpose": "maskable" }{{ end }} ], + {{- end }} "start_url": "/", "display": "browser", "background_color": "#ffffff", diff --git a/layouts/partials/functions/init.html b/layouts/partials/functions/init.html index 356e50b8..dcc0a6ff 100644 --- a/layouts/partials/functions/init.html +++ b/layouts/partials/functions/init.html @@ -36,10 +36,10 @@ {{ with .Site.Data.manifest }} - {{ with index . "main.js" }} + {{ with index . "main.js" -}} - {{ end }} - {{ end }} + {{ end -}} + {{ end -}} {{- end -}} @@ -50,20 +50,22 @@ {{/* If this is a page/post, link View Source to specific file on GitHub; otherwise, just link to repo homepage */}} -{{- with .Site.Params.social.githubRepo }} - {{- $githubURL := print "https://github.com/" . }} - {{- if not $.IsPage }} - {{- $.Scratch.Set "sourceURL" $githubURL }} - {{- else }} - {{- $.Scratch.Set "sourceURL" (print $githubURL "/blob/main/content/" $.File.Path) }} - {{- end }} -{{- end }} +{{- with .Site.Params.social.githubRepo -}} + {{- $githubURL := print "https://github.com/" . -}} + {{- if not $.IsPage -}} + {{- $.Scratch.Set "sourceURL" $githubURL -}} + {{- else -}} + {{- $.Scratch.Set "sourceURL" (print $githubURL "/blob/main/content/" $.File.Path) -}} + {{- end -}} +{{- end -}} {{/* Chooses and initializes various images for use by JSON schema & open graph tags */}} {{/* Author image (default) */}} -{{- with index .Site.Data.manifest .Site.Author.image -}} - {{- $.Scratch.Set "authorImage" (dict "Permalink" (absURL .src) "Width" 1200 "Height" 1200 "MediaType" "image/jpeg") -}} +{{- with .Site.Data.manifest -}} + {{- with index . $.Site.Author.image -}} + {{- $.Scratch.Set "authorImage" (dict "Permalink" (absURL .src) "Width" 1200 "Height" 1200 "MediaType" "image/jpeg") -}} + {{- end -}} {{- end -}} {{/* Page image (via frontmatter) */}} {{- with .Params.image -}} @@ -77,6 +79,8 @@ {{- end -}} {{- end -}} {{/* Site logo */}} -{{- with index .Site.Data.manifest .Site.Params.image -}} - {{- $.Scratch.Set "logoImage" (dict "Permalink" (absURL .src) "Width" 2048 "Height" 2048 "MediaType" "image/png") -}} +{{- with .Site.Data.manifest -}} + {{- with index . $.Site.Params.image -}} + {{- $.Scratch.Set "logoImage" (dict "Permalink" (absURL .src) "Width" 2048 "Height" 2048 "MediaType" "image/png") -}} + {{- end -}} {{- end -}} diff --git a/layouts/partials/head/_head.html b/layouts/partials/head/_head.html index 30820157..dad3a58f 100644 --- a/layouts/partials/head/_head.html +++ b/layouts/partials/head/_head.html @@ -2,9 +2,9 @@ {{ partial "head/meta" . -}} {{ partial "head/open-graph" . -}} {{ partialCached "head/mobile" . -}} +{{ partial "head/canonical" . -}} {{ partialCached "head/preload" . -}} {{ partial "head/styles" . -}} -{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32" "manifest" .Site.Data.manifest) -}} -{{ partialCached "head/feeds" . -}} -{{ partial "head/canonical" . -}} +{{ partialCached "head/favicons" . -}} +{{ partialCached "head/misc" . -}} {{ partial "head/schema" . -}} diff --git a/layouts/partials/head/canonical.html b/layouts/partials/head/canonical.html index 88a0d5f5..ed929371 100644 --- a/layouts/partials/head/canonical.html +++ b/layouts/partials/head/canonical.html @@ -1,9 +1,4 @@ -{{ if .Site.Params.social.webmentionIO }} - - -{{ end }} - - - + + diff --git a/layouts/partials/head/favicons.html b/layouts/partials/head/favicons.html index 5c7d667b..f0a0f4e7 100644 --- a/layouts/partials/head/favicons.html +++ b/layouts/partials/head/favicons.html @@ -1,12 +1,15 @@ -{{- $s := slice -}} -{{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end -}} -{{- $faviconIco := index .manifest "images/favicon.ico" }} - +{{ with .Site.Data.manifest }} + {{- with index . "images/favicon.ico" }} + + {{- end }} -{{- $faviconSvg := index .manifest "images/favicon.svg" }} - + {{- with index . "images/favicon.svg" }} + + {{- end -}} -{{- $appleIcon := index .manifest "images/apple-touch-icon.png" }} - + {{- with index . "images/apple-touch-icon.png" }} + + {{- end }} +{{ end }} diff --git a/layouts/partials/head/feeds.html b/layouts/partials/head/feeds.html deleted file mode 100644 index edac742e..00000000 --- a/layouts/partials/head/feeds.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/layouts/partials/head/misc.html b/layouts/partials/head/misc.html new file mode 100644 index 00000000..81ccd477 --- /dev/null +++ b/layouts/partials/head/misc.html @@ -0,0 +1,7 @@ +{{ if .Site.Params.social.webmentionIO }} + + +{{ end }} + + + diff --git a/layouts/partials/page/header.html b/layouts/partials/page/header.html index 80241550..31af3574 100644 --- a/layouts/partials/page/header.html +++ b/layouts/partials/page/header.html @@ -1,8 +1,10 @@