diff options
author | tdro <tdro@noreply.example.com> | 2023-12-30 16:39:52 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-12-30 16:39:52 -0500 |
commit | c3f5fba9a08339035b5a409e7acef144f76fa975 (patch) | |
tree | d12f39712e4d180f61450cca15a85589ad99e476 | |
parent | 937d0e35700c85c7d683dd33a7f542442d8ec11c (diff) | |
download | canory-c3f5fba9a08339035b5a409e7acef144f76fa975.tar.gz canory-c3f5fba9a08339035b5a409e7acef144f76fa975.tar.bz2 canory-c3f5fba9a08339035b5a409e7acef144f76fa975.zip |
config: Unify the manifests
Inline and use generic placeholder logo
-rw-r--r-- | assets/data/media/logo.png | bin | 170667 -> 9839 bytes | |||
-rw-r--r-- | config.json | 24 | ||||
-rw-r--r-- | config.toml | 20 | ||||
-rw-r--r-- | config.yaml | 20 | ||||
-rw-r--r-- | themes/default/layouts/_default/home.browserconfig.xml | 13 | ||||
-rw-r--r-- | themes/default/layouts/_default/index.webmanifest | 24 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-head.html | 13 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-manifest.html | 67 |
8 files changed, 86 insertions, 95 deletions
diff --git a/assets/data/media/logo.png b/assets/data/media/logo.png Binary files differindex 51baf7d..98b4003 100644 --- a/assets/data/media/logo.png +++ b/assets/data/media/logo.png 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" -}} - -<?xml version="1.0" encoding="utf-8"?> -<browserconfig> - <msapplication> - <tile> - <square150x150logo src="{{ $mstile150.Permalink }}"/> - <TileColor>#da532c</TileColor> - </tile> - </msapplication> -</browserconfig> 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 @@ <!-- HTML Meta Tags --> <meta charset="utf-8" /> -<meta name="author" content="{{ $authors.name -}}" /> +<meta name="author" content="{{ or $author $.Site.Title -}}" /> <meta name="robots" content="{{ or $noindex .Site.Params.site.robots "index,follow" }}" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="keywords" content="{{- partial "base-title.html" . -}}" /> @@ -39,9 +43,6 @@ <meta name='base-url' content="{{ "" | absURL }}" /> <meta name='last-modified' content="{{ now.UTC.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}" /> -<!-- Link Tags --> -<link rel="home" href="{{ "" | absURL }}/{{ $authors.user }}/" /> - <!-- Search Verification --> {{- 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 -}} -<link rel="icon" type="image/x-icon" href="data:image/ico;base64,{{ $icon32.Content | base64Encode }}" /> -<link rel="icon" type="image/png" sizes="16x16" href="data:image/png;base64,{{ $icon16.Content | base64Encode }}" /> -<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,{{ $icon32.Content | base64Encode }}" /> -<link rel="apple-touch-icon" sizes="180x180" href="data:image/png;base64,{{ $appleTouchIcon.Content | base64Encode }}" /> -<link rel="manifest" href="{{ .Site.BaseURL }}/site.webmanifest" /> -<meta name="msapplication-TileColor" content="#da532c" /> -<meta name="theme-color" content="#ffffff" /> +{{- $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 -}} + +<link rel="icon" type="image/x-icon" sizes="32x32" href="data:image/ico;base64,{{ $32.Content | base64Encode }}" /> +<link rel="icon" type="{{ $16.MediaType }}" sizes="16x16" href="data:{{ $16.MediaType }};base64,{{ $16.Content | base64Encode }}" /> +<link rel="icon" type="{{ $32.MediaType }}" sizes="32x32" href="data:{{ $32.MediaType }};base64,{{ $32.Content | base64Encode }}" /> +<link rel="apple-touch-icon" type="{{ $180.MediaType }}" sizes="180x180" href="data:{{ $180.MediaType }};base64,{{ $180.Content | base64Encode }}" /> + +<link rel="home" href="{{ $home }}" /> + +{{ "" -}} <!-- Newline --> + +{{- with $manifest := $.Site.Params.webmanifest -}} +<link rel="manifest" href='data:application/manifest+json,{{ merge $manifest (dict + "start_url" $home + "icons" (slice + (dict + "sizes" "192x192" + "src" (print "data:" $192.MediaType ";base64," ($192.Content | base64Encode)) + "type" (print $192.MediaType)) + (dict + "sizes" "512x512" + "src" (print "data:" $512.MediaType ";base64," ($512.Content | base64Encode)) + "type" (print $512.MediaType)))) + | jsonify + | urlquery +}}'> + +<meta name="msapplication-TileColor" content="#da532c" /> +<meta name="msapplication-config" content="none" /> +<meta name="msapplication-square70x70logo" content="none" /> +<meta name="msapplication-square150x150logo" content="data:{{ $180.MediaType }};base64,{{ $180.Content | base64Encode }}" /> +<meta name="msapplication-square310x310logo" content="none" /> +<meta name="msapplication-wide310x150logo" content="none" /> +{{- end -}} +{{- end -}} |