trwnh.com/unified.test.hugo/layouts/_default/list.jsonfeed.json

100 lines
4.8 KiB
JSON
Raw Normal View History

2024-10-16 05:34:37 +00:00
{{/* TODO: read the spec and write this template layout */}}
{
"version": "https://jsonfeed.org/version/1.1",
"title": {{ .Title | jsonify }},
"home_page_url": "{{ .Permalink }}",
"feed_url": "{{ (.OutputFormats.Get "jsonfeed").Permalink }}"
{{- with (.Summary | jsonify) }},
"description": {{.}}
{{- end }},
"user_comment": "does anyone even use jsonfeed lmao",
{{- /* next_url = allows for pagination but i don't think i have to worry about that yet. TODO:?*/}}
"icon": "https://trwnh.com/.assets/icon.png", {{- /* TODO: make this variable (512x512?) */}}
"favicon": "https://trwnh.com/.assets/icon.png", {{- /* TODO: make this variable and also 64x64 */}}
"authors": [ {{- /* TODO: make this variable and also loopable? */}}
{
"name": {{ (or .Params.author.name .Site.Params.author.name ) | jsonify }},
"url": {{ (or .Params.author.url .Site.Params.author.url .Site.Home.Permalink .Site.BaseURL) | jsonify }},
"icon": "https://trwnh.com/.assets/icon.png" {{- /* TODO: make this variable (512x512?) */}}
}
],
"author": { {{- /* TODO: make this variable */}}
"name": {{ (or .Params.author.name .Site.Params.author.name ) | jsonify }},
"url": {{ (or .Params.author.url .Site.Params.author.url .Site.Home.Permalink .Site.BaseURL) | jsonify }},
"icon": "https://trwnh.com/.assets/icon.png" {{- /* TODO: make this variable (512x512?) */}}
},
"language": {{ (or .Language.LanguageCode .Site.Language.LanguageCode) | jsonify }},
"expired": false, {{- /* TODO: allow for marking feeds as disabled? */}}
"hubs": [], {{- /* TODO: allow defining rsscloud or websub hub with `type` and `url` */}}
"items": [
{{- range $index, $item := .RegularPages }} {{- /* TODO: if/when i paginate this i need to range over the paginator instead of pages */}}
{
"id": "{{.Permalink}}",
"url": "{{.Permalink}}"
{{- with "" }}, {{- /* TODO: "this is useful for linkblogs" -- wtf is a linkblog exactly? look into this. is it more or less the same as inReplyTo? */}}
"external_url": "{{.}}"
{{- end }}
{{- with .Title }},
"title": {{ . | jsonify }}
{{- end }}
{{- with .Content }},
"content_html": {{. | jsonify}} {{- /* TODO: handle the content_text case for plaintext content. (how to detect if content is plainifyable? just do it always? when to omit content_html? never?) */}}
{{ else }}, {{- /* if there isn't any content, we still have to put something bc it's a required field */}}
"content_text": ""
{{- end }}
{{- if isset .Params "summary" }}
{{- with .Summary }},
"summary": {{ . | jsonify }}
{{- end }}
{{- end }}
{{- with "" }}, {{- /* TODO: handle featured images */}}
"image": "{{.}}"
{{- end }}
{{- with "" }}, {{- /* TODO: wtf is this */}}
"banner_image": "{{.}}"
{{- end }}
{{- with .Date }},
"date_published": "{{.Format "2006-01-02T15:04:05-07:00"}}"
{{- end }}
{{- with .Lastmod }}, {{- /* TODO: should this only be present if the post was edited? */}}
"date_modified": "{{.Format "2006-01-02T15:04:05-07:00"}}"
{{- end }},
"authors": [ {{- /* TODO: make this variable and also loopable? or should this be omitted since it's implied by the top-level prop? maybe omit it only when it's equal? */}}
{
"name": {{ (or .Params.author.name .Site.Params.author.name ) | jsonify }},
"url": {{ (or .Params.author.url .Site.Params.author.url .Site.Home.Permalink .Site.BaseURL) | jsonify }},
"icon": "https://trwnh.com/.assets/icon.png" {{- /* TODO: make this variable (512x512?) */}}
}
],
"author": { {{- /* TODO: make this variable? or should this be omitted since it's implied by the top-level prop? maybe omit it only when it's equal? */}}
"name": {{ (or .Params.author.name .Site.Params.author.name ) | jsonify }},
"url": {{ (or .Params.author.url .Site.Params.author.url .Site.Home.Permalink .Site.BaseURL) | jsonify }},
"icon": "https://trwnh.com/.assets/icon.png" {{- /* TODO: make this variable (512x512?) */}}
}
{{- with .Params.tags }},
"tags": {{. | jsonify}}
{{- end }}
{{- with (or .Language.LanguageCode .Site.Language.LanguageCode) }}, {{- /* TODO: should this only be present if it differs from top-level feed language? */}}
"language": {{. | jsonify}}
{{- end }}
} {{- if ne $index (sub (len $.RegularPages) 1)}},{{end}}
{{- end }}
]
{{- with "" }},
"attachments": [ {{- /* TODO: what to use for this? detect "podcast" or similar cases where there are "related resources" to be listed */}}
{{- range . }}
"url": {{.Permalink|jsonify}},
"mime_type": "application/octet-stream" {{- /* TODO: detect this. it's required. */}}
{{- with .Name }},
"title": {{.|jsonify}}
{{- end }}
{{- with "" }}, {{- /* TODO: detect this optionally. */}}
"size_in_bytes": {{.|jsonify}}
{{- end }}
{{- with "" }}, {{- /* TODO: detect this optionally. */}}
"duration_in_seconds": {{.|jsonify}}
{{- end }}
{{- end }}
]
{{- end }}
}