JSON to Content

Hey all, new to Middleman.

My goal is to generate a site with a page for every US State and City. Thus, the output of the build would be 50 state folders with an index.html, and nested within each state sub-folder would be that state’s corresponding cities.

I have all of this mapped out in JSON, but struggling to find a good solution.

While there are roughly 30000 nodes in the json array, I’d only be using two templates, one for “state” pages, and one for “city” pages.

Is this possible to do with existing Middleman functionality?

Thanks!
Noah

Yes, you can iterate through the nodes in your JSON array and create proxy pages. I created an example for this question, which was trying to achieve something similar. Hopefully that will be helpful to you.

1 Like