I have the following code rendering a .json
file for a section.
{{- $.Scratch.Add "index" slice -}}
{{- range .Data.Pages -}}
{{- $.Scratch.Add "index" (dict "objectID" ( printf "issue_%s" .Slug ) "issue" ( int .Slug ) "uri" .Permalink "title" .Title "blurb" ( .Params.description | plainify ) "tags" .Params.tags) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
Currently it outputs all of the separate dict’s inside a list, eg:
[
{
"blurb": "lah",
"issue": 1,
"objectID": "issue_1",
"tags": [
"some tag"
],
"title": "some title",
"uri": "http://example.com/1/"
},
{
"blurb": "lah",
"issue": 2,
"objectID": "issue_2",
"tags": [
"some tag"
],
"title": "some title",
"uri": "http://example.com/2/"
}
]
Is there a way to remove all the items from inside the list and just have raw dicts, eg:
{
"blurb": "lah",
"issue": 1,
"objectID": "issue_1",
"tags": [
"some tag"
],
"title": "some title",
"uri": "http://example.com/1/"
},
{
"blurb": "lah",
"issue": 2,
"objectID": "issue_2",
"tags": [
"some tag"
],
"title": "some title",
"uri": "http://example.com/2/"
}