Files
FixIt/layouts/home.manifest.webmanifest
T
Cell 5cad4d3df9 refactor(assets): PWA improvements and app config snake_case migration (#790)
- Service worker: versioned cache name, navigation preload, stale-while-revalidate for images
- New PWAModule extracted from MiscModule with async registration and update detection
- SW update notification toast in Hugo template with i18n support (16 languages)
- Web app manifest template (site.webmanifest) generated from [params.app] config
- [params.app] keys migrated to snake_case: name, short_name, pwa, no_favicon, svg_favicon, mask_color, tile_color, theme_color
- enablePWA moved from [params] to [params.app].pwa
- theme_color no longer accepts single-value, only {light, dark} map
- EventBus: new fixit:sw-update event
- SCSS: new _sw-toast.scss widget for update notification
2026-06-24 12:43:37 +08:00

31 lines
1.5 KiB
JSON

{{- if .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 -}}