Unlike RSS, JSON output needs a layout and an explicit outputs list.
Section list as JSON
layouts/projects/list.json:
{
"projects": [
{{- range $index, $page := (where .Site.RegularPages "Type" "in" "projects") }}
{{- if $index -}} , {{- end }}
{
"url": {{ .Permalink | jsonify }},
"title": {{ .Title | jsonify }}
}
{{- end }}
]
}
In content/projects/_index.md:
outputs:
- HTML
- JSON
- RSS
Then open /projects/index.json.
Custom URL caveat
url: /projects.json
If you set url on that section index, Hugo stops rendering the HTML page for it — there is no per-format URL mapping.
When alternative formats are linked in the head (see templates ), the JSON feed appears next to RSS automatically.
Andrew Dorokhov