Transform JSON in git repo into Hugo-friendly files at build time

I have blog posts stored as JSON documents in a git repo that I would like to use with Hugo to build a website on Netlify.

The keys used in the JSON don’t currently map to Hugo’s frontmatter format, so I would like to transform the files at build time (pre-build?) so that Hugo will accept them as posts.

I want to maintain the files in their current format in the repo because the CMS I use reads/writes posts using this, so transforming them in the repo isn’t an option.

Is it possible to transform source with Netlify, perhaps by writing a build plugin? Are there any examples I could follow?

Hi @barryf,

There are currently no Build plugins for this specific use case, but writing one is definitely an option!
The documentation to plugin creation is here. Please feel free to ask any questions along the way!

Thanks @ehmicky. I’ll have a read through the docs and example plugins.

1 Like