Create page dynamically from data files?

Is it possible to dynamically create a page for data in the data file?

As in for every element in an array in my datafile, I want a unique .html file for it without writing multiple md files.

1 Like

Currently no.

1 Like

I think this would be a great addition to get an author page (ā€˜post byā€™ pages)

This would be a nice feature, or something that can give control to generate more pages. My case is that I want multiple galleries under different sections, but donā€™t want to have to repeat code by creating something like a list in layouts per section.

1 Like

Any update on this? I have a very practical case: I want to build a site that has a page for every city/town in the United States (yikes!), about 30,000 pages or so. Iā€™ve converted a SQL table to JSON and contains things like cityName, state, ID, population, long, lat, etc.

Using that data, Iā€™d like to tell Hugo to build pages off of each item in the (giant) array. The end result would be a well manicured subtree of states, and city-pages within each state subfolder.

Sounds easy, right!? :slightly_smiling:

1 Like

Nothing has changed on this. Your best approach right now is to generate content files for each city based on the data. Use the content front matter to store your custom fields.

It would be a great Hugo feature, if we can create multiple HTML pages from single json file in data directory. Kindly update here is anyone is aware how to do it. Thanks a lot in advance

1 Like

Please follow the latest development on https://github.com/gohugoio/hugo/issues/5074 ā€œBuild pages from data sourceā€

The ā€œlatest developmentā€ on that issue is much like watching paint dry ā€¦ Boring as hell, but I guess cool when we get there ā€¦

4 Likes