Files
fundor333.com/themes/fugu/layouts/index.json
Fundor333 4715eb1ec6 fix
2024-02-11 01:47:32 +01:00

52 lines
1.7 KiB
JSON

{
"version": "https://jsonfeed.org/version/1",
"title": {{ .Site.Title | jsonify }},
"home_page_url": {{ .Permalink | jsonify }},
{{ with .OutputFormats.Get "json" -}}
"feed_url": {{ .Permalink | jsonify }},
{{- end }}
{{ if .Site.Params.author -}}
"author": {
"name": {{ .Site.Params.author | jsonify }}
},
{{- end }}
{{ if .Data.Pages }}
"items": [
{{ range $index, $element := (where .Site.RegularPages "Params.specialpost" "!=" true)}}
{{ if $index }},{{end}} {
"title": {{ $element.Title | jsonify }},
"id": {{ $element.Permalink | jsonify }},
"url": {{ $element.Permalink | jsonify }},
{{- $pagePermalink := .Permalink -}}
{{- with .Params.images -}}
{{- $img := index . 0 -}}
"image": "{{ printf "%s%s" $pagePermalink $img }}",
{{ else -}}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
"image": "{{ $featured.Permalink }}",
"banner_image": "{{ $featured.Permalink }}",
{{- else -}}
{{- with .Site.Params.images -}}
"image": "{{ index . 0 | absURL }}",
{{- end -}}
{{- end -}}
{{- end }}
"summary": {{ $element.Summary | jsonify }},
{{ if eq $element.Type "link"}}
"external_url": {{ $element.Params.link | jsonify }},
{{ end }}
"content_html": {{ $element.Content | jsonify }},
"content_text": {{ $element.Plain | jsonify }},
{{- if .Params.tags -}}
"tags": [{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}"{{ $e }}"{{ end }}],
{{ end }}
"date_published": "{{ .Date }}"
}
{{ end }}
]
{{ end }}
}