Towards Hugo

I moved my blog from Jekyll to Hugo, the not-so-new and cool thing for static pages. I didn’t pick Jekyll consciuously—it’s just that before Netlify I had my blog hosted on GitHub Pages which runs on Jekyll.

Jekyll wasn’t bad per se, but I didn’t like some things:

  • The template engine and the way template inheritance works is kind of weird. Some things like filtering lists are really hard.
  • Jekyll’s rather slow to build. I like to see my posts evolve as I write so I keep a browser open next to my VSCode which live-reloads the page. Jekyll had a plugin for live-reloading, but it built so slowly that it wasn’t really live-reloading.
  • I had to setup a Ruby environment and keep it up to date to even build my site. I don’t do Ruby at all, so I always forgot and things stopped working and I had to fix the Ruby environment before I could even start writing. Also, it’s really hard to setup Ruby on Windows.

Moving to Hugo

I tried hugo import but it crashed and did’t import posts properly—there was a nil error somewhere, perhaps I had some weird frontmatter. Didn’t spend much time on debugging this issue—I took the opportunity to start from scratch. I looked at all the Hugo themes—there are some really cool ones, like Academic, which reminds me of Minimal Mistakes for Jekyll which I used for a long time. I started from Cocoa but I really wanted to keep my favorite Vollkorn font, so I started my own theme, based on my old design, but I added all the things I learned about typography since so it’s a bit better now, hopefully. Then I imported all my posts manually—luckily I’m not so productive, so there weren’t too many.

The hardest part was getting my Atom feed back. Hugo only supports RSS, so I made my own Atom template and added a corresponding content type. The Hugo documentation doesn’t help a lot here, so it was much trial and error. You can see the results in the source code.

Things I like and don’t like about Hugo

I think I’d have been faster, if Hugo’s docs were better. There’s a lot of documentation, but often it’s rather brief. Making a custom content type for Atom feeds is like a standard thing, and it’s actually quite simple to setup, but there’s no helpful guide, just some reference documentation, so you’ve got to figure out how all pieces fit together which takes more time.

Also, some features are kind of unfinished. Hugo’s got a “page bundle” feature where you can put images and other resources next to the blog post. That’s a nice idea, but it looks like Hugo gives you no way to access the images in a page bundle from the Markdown file? You can only use them from templates, so the feature’s good for image galleries, but not so good for blog posts.

But overall I really like Hugo. The way it structures the content is really well-thought; I never really like the weird special case for _posts in Jekyll. I also like that the date of a post is now only in the front matter and not in the filename anymore. And yay, all static files go into a dedicated directory, so I don’t have dozens of files cluttering the top-level directory anymore. The template engine’s still a bit weird, but it’s got proper template inheritance similar to Jinja2, and it much more powerful than the one in Jekyll.

But best of all, Hugo’s really fast. Like, really really fast. When I save a post hugo server builds so fast that the browser reloads almost instantly. That’s very cool!

Am happy now!