Skip to content

Commit

Permalink
Add manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheberle committed Mar 25, 2024
1 parent 3f10c6f commit 173996a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utilities/assets/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- with .Site.Params.favicon -}}
{{- with .png -}}
{{- $img := resources.Get . -}}
{{- $icons := slice (dict "src" ($img.Process "resize 192x").RelPermalink "type" "image/png" "sizes" "192x192") (dict "src" ($img.Process "resize 512x").RelPermalink "type" "image/png" "sizes" "512x512") -}}
{{- dict "icons" $icons | jsonify (dict "indent" " ") -}}
{{- end -}}
{{- end -}}
4 changes: 4 additions & 0 deletions utilities/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
[module.hugoVersion]
min = "v0.112.0"

[[module.mounts]]
source = "assets"
target = "assets"

[[module.mounts]]
source = "partials"
target = "layouts/partials"
Expand Down
2 changes: 2 additions & 0 deletions utilities/partials/favicon.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
<link rel="apple-touch-icon-precomposed" href="{{ ($img.Process "resize 180x").RelPermalink }}">
<link rel="icon" href="{{ ($img.Process "resize 32x").RelPermalink }}" sizes="32x32">
<link rel="shortcut icon" href="{{ ($img.Process "resize 196x").RelPermalink }}" sizes="196x196">
{{- $manifest := resources.Get "site.webmanifest" | resources.ExecuteAsTemplate "/site.webmanifest" page.Page -}}
<link rel="manifest" href="{{ $manifest.RelPermalink }}" crossorigin="use-credentials">
{{- end }}
{{- end }}

0 comments on commit 173996a

Please sign in to comment.