Create basic scripts to generate JSONs from images

This commit is contained in:
2024-10-21 19:03:23 +02:00
parent 2782838276
commit 9d9182e268
7 changed files with 67 additions and 28 deletions

View File

@@ -0,0 +1,15 @@
{{- $first := true -}}
{{- range .Pages.ByTitle -}}
{{- if not $first }}, {{ end }}
{{ $first = false -}}
{
"title": "{{ .Title }}",
{{- with .Resources.GetMatch "album.zip" }}
"albumDownload": "{{ .RelPermalink }}",
{{ else -}}
{{ warnf "Could not find album.zip for %s" .RelPermalink -}}
{{ end -}}
"images": [{{ partial "albums/images.json" . }}],
"albums": [{{ partial "albums/albums.json" . }}]
}
{{ end -}}

View File

@@ -0,0 +1,12 @@
{{- $first := true -}}
{{- range .Resources.ByType "image" -}}
{{- if not $first }}, {{ end }}
{{ $first = false -}}
{
"title": "{{ .Title }}",
"url": "{{ .RelPermalink }}",
"width": "{{ .Width }}",
"height": "{{ .Height }}",
"thumbnail": "{{ (.Fit "200x200").RelPermalink }}"
}
{{ end -}}