blog/layouts/index.json
jolheiser 9978b12eac Index JSON (#249)
This will expose a JSON endpoint with all the pages and some meta.

It would allow us to, for example, filter posts by `tag` and maybe link to them from our main docs.

e.g. a follow-up PR to tag any "feature preview"-style posts and then link to them from our docs.

Reviewed-on: gitea/blog#249
Reviewed-by: delvh <dev.lh@web.de>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-04-11 22:30:13 +08:00

6 lines
234 B
JSON

{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "title" .Title "tags" .Params.tags "contents" .Plain "permalink" .Permalink) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}