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 /themes/default/layouts/partials | |
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
Diffstat (limited to 'themes/default/layouts/partials')
-rw-r--r-- | themes/default/layouts/partials/base-head.html | 13 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-manifest.html | 67 |
2 files changed, 62 insertions, 18 deletions
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 -}} |