Create basic scripts to generate JSONs from images
This commit is contained in:
15
layouts/partials/albums/albums.json
Normal file
15
layouts/partials/albums/albums.json
Normal 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 -}}
|
||||
12
layouts/partials/albums/images.json
Normal file
12
layouts/partials/albums/images.json
Normal 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 -}}
|
||||
Reference in New Issue
Block a user