Hello,
I did a search on the forum for whether someone else has used gomplate with Hugo but found no results, so I thought I’d write something up.
While waiting for this issue to resolve, I stumbled across gomplate, which is a template renderer that supports several data sources. It uses the same syntax that Hugo does, which means if you can use Hugo, you can pretty much use gomplate as well.
So, what is it?
In my specific example, I use gomplate to generate markdown files from a JSON endpoint. I feed it a template so it knows how to map json to frontmatter keys, for example.
An example workflow would be:
- Run
gomplateto populatecontent/posts/ - Run
hugoto generate site
See site demo deployed to netlify: https://quizzical-wozniak-468938.netlify.app/
See sample repo: https://github.com/pointyfar/hugomplate-demo
- navigate to
hugo-demofor Hugo site demo - additional examples using local csv and json files can be found under
gomplate-demo
See gomplate docs: https://docs.gomplate.ca/

