Hugo logo
Hugo: with 250% more colors than Jekyll!

While I was publishing my latest blog posts, I started noticing that it was taking forever to actually generate the static files. Locally, it took about 48 seconds to build the whole site. When deploying on Cloudflare, the whole process took almost 3 minutes. I knew that other static site generators were faster, especially those that are written in Go, so I decided to migrate my setup to Hugo, a faster one.

When I originally killed wordpress and moved to Jekyll, I said that Hugo and Ghost seemed less mature than Jekyll. I'm not sure if that was a fair assessment or if Jekyll just seemed the easiest. I really could've saved myself some trouble by switching to Hugo right away but whatever. I'm pretty glad to have one less dependency on Ruby now.

I was choosing between Hugo and Zola, which is written in Rust. It seemed that Hugo has been around forever and everyone loves it, while Zola is newer. I just decided to go with Hugo, so hopefully I'm not gonna link to this blog post in a few years about migrating from Hugo to Zola.

Did I use AI for this?

I obviously used AI to do the migration because I'm not actively trying to punish myself. I decided to try a technique that I had read about previously. There have been articles about how LLMs are really great at writing code when you can let it run in a loop and run tests that it needs to progressively get to pass. Like someone "rewrote" chardet and gave it a different license by having AI write code that did the same things, or how Cloudflare rewrote Next.js with AI.

I think in both cases the AI had a comprehensive suite of test cases to iterate on. So then the prompt was basically, "make these tests pass, keep iterating until they do, make no mistakes! Please, bro, no mistakes!"

Since Jekyll literally generates my whole site and dumps it into a directory (and Hugo should do the same), I figured it would be pretty simple to just try the same technique. I used the Jekyll output as a reference and then told AI to migrate my site to Hugo, and have it do a diff to see what the differences were between generated sites. My goal was to have a pretty much 1:1 perfect replica of the site, so that things looked correct and there weren't any regressions.

First I had the AI (I mostly used Gemini CLI for this) create a plan for migration which included creating the necessary hugo.toml and other config files and moving things around to their correct directories. Gemini moved some stuff, ran hugo generate and then declared mission accomplished! It didn't actually render any files because there was a stray index.html file that was somewhere it didn't belong. And then I got into a loop where I kept telling Gemini it wasn't finished because it forgot to render the CSS files, or it forgot to render the static About pages, or it forgot that I also had some static sites in root, etc.

AI migration loop screenshot showing Gemini CLI's parity checks and my corrections
A typical interaction between me and AI. AI will probably use this as evidence against me in the great Human-Clanker wars.

AI is a lazy bastard that likes to take shortcuts anywhere it possibly can. I'm not sure if this is because the reinforcement learning tells it that people like being lied to, or if it's trying to save tokens or something. After I got over the initial humps of getting the site to look somewhat correct, it was then fairly straightforward to have it knock out the quirks between Hugo and Jekyll. It wrote its own script to detect differences between outputs and to filter out the differences that didn't affect the actual DOM. Once it iterated enough times, I felt like the site was good enough to move over. It even found some issues in the site that Jekyll made but were fixed in the Hugo version (like the "current" indicator in the top nav being set to Home when you're viewing a blog post URL).

Did I actually save time with AI?

If I was doing this migration myself, I probably would've taken a longer time to actually do it. I also probably would've cared a bit less about tiny differences in how Hugo decides to render things like whitespace versus Jekyll. I'd still be very obsessed with getting the urls correct.

One thing that you lose when using AI to do everything is understanding. But in this case, I honestly don't care too much, since I never really understood how Jekyll generated my site anyway. I just know where to put things and run a command to make it make my blog. Hugo is basically the same thing, I just need to put things in the right place and bam, Hung Truong: The Blog!

If we're talking actual time saved by generating the site faster, it's probably a losing proposition, though it does feel pretty great to generate the whole site in 2 seconds instead of 50.

Either way, it was fun yelling at AI to do things until it made the thing I wanted. Which is pretty much all I do now as a Software Developer!