Create pages based on data files

Is it possible to generate pages using data files? For example, using YAML files such as cities.yml and services.yml, could I create pages like /cities/services? This would allow Hugo to quickly create 100 pages. Does this make sense?

The pages could be structured like /city1/service1, /city1/service2, /city1/service3, /city2/service1, /city2/service2, and so on.

Thank you.

I don’t think that’s possible right now, but you can find some workarounds in this forum, which mostly involves creating hugo content files from a data file:

For more info, see the issues:
Build pages from data source (#5074)
Pages from data, take 5 (#6310)

1 Like

Thanks @rmaguiar I’m checking this topic but it’s 4 years ago =/ maybe have some updated solution ?

This works for me:
https://www.thenewdynamic.com/article/toward-using-a-headless-cms-with-hugo-part-2-building-from-remote-api/

Example of a multilingual site:
https://github.com/jmooring/hugo-pages-from-data

3 Likes

@jmooring Great, thank you. I will check it.