I first learned about Hugo quite some time ago, and there’s a lot to like. I quite like (even though I suck at it) the Go language, and I’ve been looking for an excuse to hack on it some more. It’s very fast, and has some built in features I’d been meaning to write scripts for Pelican to do (like creating new posts automatically). Plus there’s the whole live preview thing, which looked pretty neat.
Pelican, I absolutely adore, but it’s so very slow. If I make one tiny change, my 12-cores of X5650 Xeons take approximately 15 seconds to regenerate all 600-something blog posts into a static site. In contrast, Hugo does it in about 400ms, but the live-reload thing makes it even nicer… if you have the local site open in a browser on one screen, and save in your editor on the other, your changes are already there for you. That makes it super-nice to blog on!
So anyway, one of my co-workers mentioned using it for a site and I decided to have another crack at it after work on Friday, as one does.
I wrote a short script to convert my Pelican markdown to the YAML-based frontmatter that Hugo wants. It’s pretty nasty and super-specific to my site, but it works.
I had to change several things around, such as creating a handful of
_index.md files, and fixing one or two timestamps that weren’t in the formats my script handles (Pelican is apparently not terribly picky!). By far the absolute longest part was porting the theme across - I thought I could save some time by starting with a minimalist Bootstrap theme, but I’m honestly not sure it saved anything as it’s laid out completely different to mine in both HTML and how I wanted it.
However after about three hours of tinkering (with a break for dinner in the middle, so around 5 hours total), I’ve got it almost complete. There’s a handful of things I still need to fix - chief among them the internal links which all link to .html files, and I may just rip the bandaid off and remove the extensions like I should have done some four years ago when I ditched blogger.
After that it’s mainly just cleaning up the theme files, and shifting the GitHub repo that drives my site across, and working out how to push it up to the server that hosts the live version. Comparatively speaking, that stuff is the easy part. Here’s a list of the stuff that I know is still broken:
- MathJax - I think I can fix this fairly easily though.
- Minifying JS/CSS - “Hugo Pipes” looks the ticket for solving this.
Next/previous links - what Pelican calls “Neighbours” and I accomplished with a plugin, not 100% sure how to do it with Hugo.Dead simple with .NextInSection and .PrevInSection.
- Yearly/monthly indexes - this seems to be an ongoing problem that a few folks coming across from WP/Blogger complain about. Not 100% sure I give a shit, to be honest.
Edit 2019-11-03: I’ve decided that I’ll just leave the .html off the URLs, and put some 301 redirects on my webserver to handle stripping them off.