Generate a geoJSON file/data

In Jekyll you can just create a file file.geojson anywhere in your data directory or root directory and use normal for loop to generate the repeating JSON data.

Since data files in Hugo needs to be .yml, .yaml, .json, or .toml extension. Using data is a not an option, even though it would fit nicely there since it just need to load the file into another .html template.

I doesn’t need to generate a page, I just need to range through .Pages in a section and generate the file.

Should I just store it in the _layouts/section folder? I just doesn’t seem like the right place for this.

You can do that with custom output types. They don’t work in the data folder, but you can create the file (once you’ve declared it in config https://gohugo.io/templates/output-formats/) at the root of your layouts.