I have an index.json file that is used by the main site search. I am trying to create a secondary one for another search using output formats, but the JSON file defaults to the content in the index.json. I have copied the steps in the repo below to create the output format in my own theme.
Or what is the recommended way to create a secondary JSON index besides index.json?
Example
Weβre going to generate two json files in the root of the public directory. One will be named index.json, the other will be named index_2.json.
Site configuration
[outputs]
home = ['HTML', 'JSON', 'JSON_2']
# We don't need to define the JSON output format. It's baked in.
[outputFormats.JSON_2]
baseName = 'index_2'
isPlainText = true
mediaType = 'application/json'
Layouts
layouts/
βββ _default/
βββ baseof.html
βββ home.html
βββ home.json_2.json <-- generates public/index_2.json
βββ home.json.json <-- generates public/index.json
βββ list.html
βββ single.html
Try it:
git clone --single-branch -b hugo-forum-topic-41808 https://github.com/jmooring/hugo-testing hugo-forum-topic-41808
cd hugo-forum-topic-41808
hugo server
This might have been the issue.