Can generated Web Manifest and generation of similar site files be supported.
Zola is not really meant for PWA, what do you use web manifests for in a static site?
Mainly explicitly set the different favicons.
Also looking to generate humans.txt, security.txt
, hackers.txt
, etc. and other such files for completeness.
These are Hugo templates below.
.\assets\browserconfig.xml
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
{{ range $val := (index $.Site.Data.icons "msapplication").icons }}
{{ if ne $val "TileImage" }}
<{{- $val.type }} src="{{- $val.file -}}" />
{{ end }}
{{ end }}
{{ with index (index $.Site.Data.manifests "msapplication-config") "tile-color" }}
<TileColor>{{- . -}}</TileColor>
{{ end }}
</tile>
</msapplication>
</browserconfig>
.\assets\site.webmanifest
{
"name": "{{- .Site.Title -}}",
"short_name": "{{- .Site.Title -}}",
"lang": "{{site.LanguageCode}}",
{{ with $.Site.Params.description }}
"description": "{{- . -}}",
{{ end }}
{{ with index $.Site.Data.manifests.webmanifest "theme-color" }}
"theme_color": "{{- . -}}",
{{ end }}
{{ with index $.Site.Data.manifests.webmanifest "background-color" }}
"background_color": "{{- . -}}",
{{ end }}
"display": "standalone".
"start_url": "/",
"scope": "/",
"icons": [
{{ $i := 0 }}
{{ range $favicon := $.Site.Data.icons }}
{{ range $icon := $favicon.icons }}
{{ if (fileExists $icon.file) }}
{{ $image_ext := path.Ext $icon.file }}
{{ if eq $image_ext "ico" }}
{{ $image_ext := "x-icon" }}
{{ else if eq $image_ext "svg" }}
{{ $image_ext := "svg+xml" }}
{{ else if eq $image_ext "jpg" }}
{{ $image_ext := "jpeg" }}
{{ else if eq $image_ext "tif" }}
{{ $image_ext := "tiff" }}
{{ end }}
{{- if ne $i 0 }}
,
{{ end }}
{{ $i = $i + 1 }}
{
"src": "{{- $icon.file -}}",
{{ with $icon.size }}
"sizes": "{{- . -}}",
{{ end }}
"type": "image/{{- $image_ext -}}"
}
{{ end }}
{{ end }}
{{ end }}
],
"categories": [
{{ $i := 0 }}
{{ range $categories := $.Site.Data.manifests.webmanifest.categories }}
{{- if ne $i 0 }}
,
{{ end }}
{{ $i = $i + 1 }}
"{{- $categories -}}"
{{ end }}
],
"shortcuts" : [
{{ $oi := 0 }}
{{ range $menue := $.Site.Menus }}
{{- if ne $oi 0 }}
,
{{ end }}
{{ $oi = $oi + 1 }}
{
"name": "{{- $menue.name -}}",
"url": "{{- $menue.url -}}",
"description": "{{- $menue.title -}}",
{{ with .Site.GetPage $menue.url }}
"icons": [
{{ $ii := 0 }}
{{ range $icon := .images }}
{{ if (fileExists $icon.file) }}
{{ $image_ext := path.Ext $icon.file }}
{{ if eq $image_ext "ico" }}
{{ $image_ext = "x-icon" }}
{{ else if eq $image_ext "svg" }}
{{ $image_ext = "svg+xml" }}
{{ else if eq $image_ext "jpg" }}
{{ $image_ext = "jpeg" }}
{{ else if eq $image_ext "tif" }}
{{ $image_ext = "tiff" }}
{{ end }}
{{- if ne $ii 0 }}
,
{{ end }}
{{ $ii = $ii + 1 }}
{
"src": "{{- $icon.file -}}",
{{ with $icon.size }}
"sizes": "{{- . -}}",
{{ end }}
"type": "image/{{- $image_ext -}}"
}
{{ end }}
{{ end }}
]
{{ end }}
}
{{ end }}
]
}
Want to be able to do the same in Zola. Essentially port the code from the theme.
Essentially this is having non .html
templates and a mechanism to evoke the template with data from another md
or non md
file and produce a non html
output. Other than this nothing special need to be done. What is needed is a generalisation of what is already been done with html
and md
files which can be the default.