Single view of information on data/articles.json

Option A - Pages from Data

Perhaps the cleanest approach is to automatically create a page for each entry in the JSON file. Hugo can’t do that yet. See:

Option B - List Everything, Display None/One

Next you could look at creating a monolithic page with all of the entries, each encapsulated by a parent element with a unique id and CSS display property set to none. Then include the unique id in the URL (e.g., https://example.com/results?id=123), and use some JS to toggle the CSS display property of the related element.

Option C - gomplate

See https://discourse.gohugo.io/t/using-gomplate-to-generate-pages-from-data-sources/27160

n.b. I have no experience with this approach.

Option D - External Script

Something like https://discourse.gohugo.io/t/split-a-json-array-into-markdown-files/30919.

n.b. I have no experience with this approach.

1 Like