From c3f5fba9a08339035b5a409e7acef144f76fa975 Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 30 Dec 2023 16:39:52 -0500 Subject: config: Unify the manifests Inline and use generic placeholder logo --- themes/default/layouts/partials/base-head.html | 13 +++-- themes/default/layouts/partials/base-manifest.html | 67 ++++++++++++++++++---- 2 files changed, 62 insertions(+), 18 deletions(-) (limited to 'themes/default/layouts/partials') diff --git a/themes/default/layouts/partials/base-head.html b/themes/default/layouts/partials/base-head.html index 0fbeb3a..a32b08d 100644 --- a/themes/default/layouts/partials/base-head.html +++ b/themes/default/layouts/partials/base-head.html @@ -1,7 +1,11 @@ {{- $noindex := "" -}} +{{- $image := "" -}} {{- $author := .Section -}} -{{- $authors := partial "function-authors-data.html" . -}} -{{- $image := print ("" | absURL) "/data/media/" $author "/" $author "-profile.png" -}} +{{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}} + +{{- if not $kind -}} + {{- $image = print ("" | absURL) "/data/media/" $author "/" $author "-profile.png" -}} +{{- end -}} {{- with or .Params.Feed .Params.Unlisted .Params.ExpiryDate -}} {{- $noindex = "noindex,nofollow" -}} @@ -9,7 +13,7 @@ - + @@ -39,9 +43,6 @@ - - - {{- partial "base-search.html" . -}} diff --git a/themes/default/layouts/partials/base-manifest.html b/themes/default/layouts/partials/base-manifest.html index 66e2354..52be1f9 100644 --- a/themes/default/layouts/partials/base-manifest.html +++ b/themes/default/layouts/partials/base-manifest.html @@ -1,15 +1,58 @@ -{{- $icon := resources.Get .Site.Params.webmanifest.logo -}} +{{- $author := .Section -}} +{{- $home := or ("" | absURL) "/" -}} +{{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}} +{{- $logo := .Site.Params.webmanifest.logo -}} +{{- $profile := print "public/data/media/" $author "/" $author "-profile" -}} -{{- $icon32 := $icon.Fit "32x32" -}} -{{- $icon16 := $icon.Fit "16x16" -}} -{{- $appleTouchIcon := $icon.Fit "180x180" -}} +{{- if not $kind -}} + {{- $home = print ("" | absURL) "/" $author "/" -}} + {{- if fileExists (print $profile ".gif") -}} {{- $logo = (print $profile ".gif") -}} {{- end -}} + {{- if fileExists (print $profile ".webp") -}} {{- $logo = (print $profile ".webp") -}} {{- end -}} + {{- if fileExists (print $profile ".png") -}} {{- $logo = (print $profile ".png") -}} {{- end -}} +{{- end -}} -{{- $ico := $icon32.Content | resources.FromString "/favicon.ico" -}} +{{- with $logo = resources.Get $logo -}} - - - - - - - +{{- $16 := $logo.Fit "16x16" -}} +{{- $32 := $logo.Fit "32x32" -}} +{{- $180 := $logo.Fit "180x180" -}} +{{- $192 := $logo.Fit "192x192" -}} +{{- $512 := $logo.Fit "512x512" -}} + +{{- if (eq $.Page.Kind "home") -}} + {{- $writeToFile := ($32.Content | resources.FromString "/favicon.ico").Permalink -}} +{{- end -}} + + + + + + + + +{{ "" -}} + +{{- with $manifest := $.Site.Params.webmanifest -}} + + + + + + + + +{{- end -}} +{{- end -}} -- cgit v1.2.3