Generate index.json based on sections and subsections

Don’t ask me why but the following is working like a charm:

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

Thank you for your suggestions, @davidsneighbour. Your help is always highly appreciated :slightly_smiling_face:

PS: My index.json has 1224 elements and a filesize of 4 mb. Now I can finally set up one of the alternatives search engines :yum:

1 Like