Files
FixIt/layouts/home.manifest.webmanifest
T
Cell 405024989c fix(assets): fix sw-update-notification display and PWA guard conditions
- Change sw-toast default from `display: flex` to `display: none` with proper CSS discrete transition
- Add `display: flex` in `.visible` state and `allow-discrete` transition for display property
- Restore production-only guard for SW notification and webmanifest templates
- Fix PWA config enable to always be true when template is rendered
- Fix extra space in head/index.html conditional
2026-07-13 16:50:10 +08:00

31 lines
1.6 KiB
JSON

{{- if not hugo.IsServer | and hugo.IsProduction | and .Site.Params.app.pwa -}}
{{- $name := .Site.Params.app.name | default .Site.Title -}}
{{- $shortName := .Site.Params.app.short_name | default $name -}}
{{- $startURL := relURL "/" -}}
{{- $display := "standalone" -}}
{{- $themeColor := "" -}}
{{- with .Site.Params.app.theme_color -}}
{{- $themeColor = .light -}}
{{- end -}}
{{- $bgColor := .Site.Params.appearance.global_background_color | default "#ffffff" -}}
{{- /* Build icons array from params.app.icons, with fallback defaults */ -}}
{{- $icons := slice -}}
{{- with .Site.Params.app.icons -}}
{{- range . -}}
{{- $icon := dict "src" .src "sizes" .sizes "type" .type -}}
{{- with .purpose -}}
{{- $icon = $icon | merge (dict "purpose" .) -}}
{{- end -}}
{{- $icons = $icons | append $icon -}}
{{- end -}}
{{- else -}}
{{- $icons = $icons | append (dict "src" (printf "%sapple-touch-icon.png" (relURL "")) "sizes" "180x180" "type" "image/png" "purpose" "any maskable") -}}
{{- $icons = $icons | append (dict "src" (printf "%sandroid-chrome-192x192.png" (relURL "")) "sizes" "192x192" "type" "image/png") -}}
{{- $icons = $icons | append (dict "src" (printf "%sandroid-chrome-512x512.png" (relURL "")) "sizes" "512x512" "type" "image/png") -}}
{{- end -}}
{{- $manifest := dict "name" $name "short_name" $shortName "start_url" $startURL "display" $display "theme_color" $themeColor "background_color" $bgColor "icons" $icons -}}
{{- $manifest | jsonify (dict "indent" " ") -}}
{{- end -}}