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 --- assets/data/media/logo.png | Bin 170667 -> 9839 bytes config.json | 24 +++----- config.toml | 20 +++--- config.yaml | 20 +++--- .../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 +++++++++++++++++---- 8 files changed, 86 insertions(+), 95 deletions(-) delete mode 100644 themes/default/layouts/_default/home.browserconfig.xml delete mode 100644 themes/default/layouts/_default/index.webmanifest diff --git a/assets/data/media/logo.png b/assets/data/media/logo.png index 51baf7d..98b4003 100644 Binary files a/assets/data/media/logo.png and b/assets/data/media/logo.png differ diff --git a/config.json b/config.json index df5cdb6..2f29e53 100644 --- a/config.json +++ b/config.json @@ -84,11 +84,13 @@ "canonical": null }, "webmanifest": { + "start_url": "/", "name": "Micro Blog", - "shortName": "Micro", - "themeColor": "#ffffff", - "backgroundColor": "#ffffff", + "short_name": "Micro", + "theme_color": "#ffffff", + "background_color": "#ffffff", "display": "standalone", + "description": "A Micro Blog", "logo": "data/media/logo.png" }, "csp": { @@ -117,10 +119,12 @@ ], "img-src": [ "'self'", + "data:", "http://preview.test" ], "manifest-src": [ - "'self'" + "'self'", + "data:" ], "media-src": [ "'self'" @@ -224,14 +228,6 @@ "baseName": "index", "mediaType": "text/html" }, - "browserconfig": { - "baseName": "browserconfig", - "mediaType": "application/xml" - }, - "webmanifest": { - "baseName": "site", - "mediaType": "application/manifest+json" - }, "gallery": { "baseName": "gallery", "mediaType": "text/html" @@ -255,10 +251,8 @@ "authors", "authors.section", "sources", - "browserconfig", "archives", - "settings", - "webmanifest" + "settings" ], "section": [ "html", diff --git a/config.toml b/config.toml index 8ca17e9..16ca22b 100644 --- a/config.toml +++ b/config.toml @@ -74,11 +74,13 @@ enableRobotsTXT = true referrer = "no-referrer" robots = "index,follow" [params.webmanifest] + start_url = "/" name = "Micro Blog" - shortName = "Micro" - themeColor = "#ffffff" - backgroundColor = "#ffffff" + short_name = "Micro" + theme_color = "#ffffff" + background_color = "#ffffff" display = "standalone" + description = "A Micro Blog" logo = "data/media/logo.png" [params.csp] block-all-mixed-content = "" @@ -88,8 +90,8 @@ enableRobotsTXT = true font-src = ["'self'"] form-action = ["'self'", "lite.duckduckgo.com"] frame-src = ["'self'", "www.youtube-nocookie.com", "en.m.wikipedia.org", "odysee.com"] - img-src = ["'self'", "http://preview.test"] - manifest-src = ["'self'"] + img-src = ["'self'", "data:", "http://preview.test"] + manifest-src = ["'self'", "data:"] media-src = ["'self'"] object-src = ["'self'"] script-src-elem = ["'self'"] @@ -156,12 +158,6 @@ enableRobotsTXT = true path = "sources" baseName = "index" mediaType = "text/html" - [outputFormats.browserconfig] - baseName = "browserconfig" - mediaType = "application/xml" - [outputFormats.webmanifest] - baseName = "site" - mediaType = "application/manifest+json" [outputFormats.gallery] baseName = "gallery" mediaType = "text/html" @@ -173,7 +169,7 @@ enableRobotsTXT = true mediaType = "text/html" [outputs] - home = ["html", "rss", "xslt.rss", "xslt.sitemap", "json", "authors", "authors.section", "sources", "browserconfig", "archives", "settings", "webmanifest"] + home = ["html", "rss", "xslt.rss", "xslt.sitemap", "json", "authors", "authors.section", "sources", "archives", "settings"] section = ["html", "rss", "gallery", "following", "webring"] taxonomy = ["html", "rss"] term = ["html", "rss"] diff --git a/config.yaml b/config.yaml index 6a4b691..6ba49df 100644 --- a/config.yaml +++ b/config.yaml @@ -66,11 +66,13 @@ params: robots: index,follow canonical: webmanifest: + start_url: / name: Micro Blog - shortName: Micro - themeColor: '#ffffff' - backgroundColor: '#ffffff' + short_name: Micro + theme_color: '#ffffff' + background_color: '#ffffff' display: standalone + description: A Micro Blog logo: data/media/logo.png csp: block-all-mixed-content: '' @@ -80,8 +82,8 @@ params: font-src: ["'self'"] form-action: ["'self'", lite.duckduckgo.com] frame-src: ["'self'", www.youtube-nocookie.com, en.m.wikipedia.org, odysee.com] - img-src: ["'self'", http://preview.test] - manifest-src: ["'self'"] + img-src: ["'self'", 'data:', http://preview.test] + manifest-src: ["'self'", 'data:'] media-src: ["'self'"] object-src: ["'self'"] script-src-elem: ["'self'"] @@ -150,12 +152,6 @@ outputFormats: path: sources baseName: index mediaType: text/html - browserconfig: - baseName: browserconfig - mediaType: application/xml - webmanifest: - baseName: site - mediaType: application/manifest+json gallery: baseName: gallery mediaType: text/html @@ -176,10 +172,8 @@ outputs: - authors - authors.section - sources - - browserconfig - archives - settings - - webmanifest section: - html - rss 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