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 --- .../layouts/_default/home.browserconfig.xml | 13 ----- themes/default/layouts/_default/index.webmanifest | 24 -------- themes/default/layouts/partials/base-head.html | 13 +++-- themes/default/layouts/partials/base-manifest.html | 67 ++++++++++++++++++---- 4 files changed, 62 insertions(+), 55 deletions(-) delete mode 100644 themes/default/layouts/_default/home.browserconfig.xml delete mode 100644 themes/default/layouts/_default/index.webmanifest (limited to 'themes/default/layouts') diff --git a/themes/default/layouts/_default/home.browserconfig.xml b/themes/default/layouts/_default/home.browserconfig.xml deleted file mode 100644 index 67bc7a3..0000000 --- a/themes/default/layouts/_default/home.browserconfig.xml +++ /dev/null @@ -1,13 +0,0 @@ -{{- $icon := resources.Get .Site.Params.webmanifest.logo -}} - -{{- $mstile150 := $icon.Fit "150x150" -}} - - - - - - - #da532c - - - diff --git a/themes/default/layouts/_default/index.webmanifest b/themes/default/layouts/_default/index.webmanifest deleted file mode 100644 index f7b3f66..0000000 --- a/themes/default/layouts/_default/index.webmanifest +++ /dev/null @@ -1,24 +0,0 @@ -{{- $icon := resources.Get .Site.Params.webmanifest.logo -}} - -{{- $androidChrome192 := $icon.Fit "192x192" -}} -{{- $androidChrome512 := $icon.Fit "512x512" -}} - -{ - "name": "{{ .Site.Params.webmanifest.name }}", - "short_name": "{{ .Site.Params.webmanifest.shortName }}", - "icons": [ - { - "src": "{{ $androidChrome192.Permalink }}", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "{{ $androidChrome512.Permalink }}", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "{{ .Site.Params.webmanifest.themeColor }}", - "background_color": "{{ .Site.Params.webmanifest.backgroundColor }}", - "display": "{{ .Site.Params.webmanifest.display }}" -} 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