First of all, I hate the fact that NodeJS has node_modules hell, which annoys me to use any JS frameworks for personal use. My personal blogs runs primarily on Hugo since 2020. Recently I have been tinkering with headless cms such as Directus & Strapi, I found them quite interesting to managing blog data and its simple and straight forward when dealing with hundreds of posts and images. Plus I have the flexibility of accessing these headless cms from all my devices and keep a Golang script running in the production server waiting for webhook request to trigger a Hugo build.
To some extent I found data templates useful to make api request and fetch posts data but Hugo seems to have limitations when it comes to pagination, or at least i couldn’t figure out how it could handle pagination for data that’s available during runtime.
Interestingly all these headless cms supports JS based static site generators out of the box with all the features required for a blog. even though they are not blazingly fast like Hugo they just fetch the data during runtime and build posts, tags, pagination etc… without breaking a sweat. (takes at least 10 to 20s depending on the number of posts)
So, I have been wondering is there any limitations in go, ruby, rust, python programming language that would limit this? I haven’t seen any SSG written in these languages handle headless cms data out of the box.
You can use the double build trick from Regis using getRemote. However that is one direction sync (content only flows from the CMS to Hugo). That is a fairly easy way to work with Hugo and an external CMS.
For a real (bi-directional) solution I would use Quiqr, CloudCannon, Forestry or some other Hugo CMS… Or use the API post method/approach Regis demonstrated on HugoConf22.
2 Likes
Actually one direction sync works for me, but unfortunately i cannot generate individual pages from the list of posts that i get as part of the response with .GetRemote
I could ignore the pagination aspect if it doesn’t work but generating individual pages is essential. Is there a way to fetch all posts from list.html and render individual posts from single.html?
i cannot generate individual pages from the list of posts that i get as part of the response with .GetRemote
You can… Read the article of Regis on the new dynamic. He explains it really well. You need an extra build step.
This is interesting… All these days I had created a posts.go script to fetch posts and download images from headless cms and then use Hugo to generate static pages. Implementing the same with Hugo within Hugo sounds tinkering and I am all in to test it out today.
It never occurred to me resources.FromString could generate files. I am wondering if it would work the same way for images
Edit: Downloading images works too …
1 Like