“Moving my blog to Hugo”

November 2017 · 5 minute read

As some of you may have noticed, I recently changed my site layout. That, however, wasn’t the only change to the site. Behind the scenes, I moved my site from Jekyll to Hugo. Let me explain why.

The awesomeness of static site generators

Over the last few years, I’ve fallen in love with static site generators. For a tinkerer, content creator and developer like me, they offer a lot of desirable things:

  • They’re infinitely customizable
  • The generated sites are easy to deploy anywhere since they don’t require any special environment (like PHP, databases, …). Anything that can serve static files (HTML, CSS, JS) can serve your site.
  • The sites are fast. I can’t stress this one too much. Since there are essentially no runtime parts to a site (maybe aside from javascript), pages load in an instant. And the browser can essentially cache everything since none of the served files are dynamically generated
  • The sites are easily scalable. Have a really popular blog post? Just deploy the html file on any number of servers (or CDNs).
  • You can have a local copy running (e.g. to preview your content while your writing)
  • Since most of them are built around Markdown, they really suit my workflow (more on that another time).

Choices, choices, choices

Naturally, I’ve tried a couple of generators over time: Jekyll, Octopress (which is technically still Jekyll), Middleman and now Hugo. All of them work fine and get the job done. However, there are subtle differences between all of them that mattered a lot to me und ultimately annoyed me enough to make me consider a move to Hugo.

Jekyll: a ruby based solution with the biggest developer community. There are a million and one plugins to customize your site to your liking. Jekyll itself has made huge progress over the years, which speaks for a healthy community. There were a few downsides, that I would like to mention:

  • The directory structure always felt messy. Mixing content and layout
  • A lot of the plugins were poorly maintained. I regularly had to fix things first before I could use them
  • The plugin infrastructure is quite messy. Yes you can customize almost everything, but I regularly found myself debugging weird issues that came from plugins interacting with each other or simply the order in which things were executed.
  • The ruby infrastructure isn’t as reliable as I would like. Things like bundler and gems are nice, but every so often they didn’t work or behaved unpredictably making me spent a lot of time debugging weird (often platform dependent) issues
  • Lack of support for internationalization. I essentially had to hack my way around it for this site. I publish things in multiple languages and Jekyll wasn’t really built for that.
  • It’s slow. With a decent sized blog like mine and a few plugins, the build would almost crawl to a halt. Incremental builds weren’t reliable either so you had to rebuild everything

Octopress: essentially Jekyll on steroids. I found that you almost needed Octopress to use Jekyll. No idea why this hasn’t been integrated into Jekyll yet. However, I often had issues with (essential) parts of Octopress falling behind and even my pull-requests/issues being ignored.
Other than that I really liked this project.

Middleman: another ruby based solution that promised to fix Jekyll’s flaws. Ultimately it suffered from the same issues as Jekyll with the added downside of a smaller developer community.

So, for me and my (admittedly special) requirements, they weren’t good choices. I’m sure others will beg to differ, and that’s fine, but I wasn’t happy with either of the sites I created using the above solutions.

World, meet Hugo

In comes Hugo: “The world’s fastest framework for building websites” It’s written entirely in Go, a language I only had heard good things about (but never tried myself until now), and blistering fast.

I will probably write a separate blog post about how I moved everything over and how my site is set up now, so let’s instead focus on my learnings.

First of all, I have to say the experience of setting up is really awesome. Install go, install hugo (both only take seconds and a single command to install) and run hugo new site mysite. And you’re good to go. Adding new blog posts, gallery items, and whatever else you may want to add is equally simple: hugo new is your friend.

The directory structure is simple and easy to understand as well. No weird underscores or complex directory structures required.
Here’s an example:

Hugo directory structure

Hugo directory structure

It also comes with the simplest integration of (multiple) themes I’ve seen so far (including overrides and all). Just add a theme to the themes folder and activate it in the config or on the command line. Done. No complex installation needed.

Hugo is fast as well! Building this entire site takes not even a second (67ms to be precise). That is quite fast considering that it’s compiling the entire site in two languages with different content for each.

Overall, the setup I have is simpler, faster and more stable than any of the solutions I had cobbled together before. And given the simplicity of Hugo, I think I will use it for even more sites.