Migrating to Hugo
Migrating from Jekyll to Hugo
I did this mainly because of two reasons: Firstly, Jekyll is too slow (because Ruby is slow). The site generation takes forever, with tags and category generation it gets even worse. I had to limit the amount of generated pages to 5 during development, to have nearly instant updates. My blog has around 80 essays. I’ve read stories of large sites, where the generation takes hours. Secondly, I wanted to stop updating Node packages and Gems (one ecosystem is enough).
Researching the options
Before I decided on Hugo, I did long research on the possible static site generators.
Another tool, which looked nice, was Roots. But after research, I found out it’s discontinued.
In the end, the features of Hugo were good and after testing it for days I decided to use it, despite having no clue about Go.
The first thing which is surprising: Hugo is a binary, which is cross-platform and after installing it, that’s it. It’s as easy on a Mac as this:
$ brew install hugo
The main reason for switching was the speed. And fast it is. Generating my whole site, with 86 essays, 125 tags, 21 categories and 2 series takes ~700 ms. This means everything included, even moving all the assets. If I wouldn’t use my Related Posts section, I could cut the time in half. Since I use Gulp and minimize, optimize and do a lot to my files, my production Gulp task needs now ~30 seconds (including syncing the files to the server), compared to 2-3 minutes before.
How fast Hugo is, can be best seen in this video: Hugo benchmark – 5,000 posts in seconds.
Hugo comes without a plugin system, but I didn’t miss any and could find a solution for everything I had on my Jekyll site before. The templates are written in Go html/template, Ace or Amber. The latter is familiar to people, who know Jade/Pug. But I choose the Go html/template. The syntax requires time to get used to, as it’s different from all template engines I’ve used before. Whenever I got stuck with a problem, the Hugo Discussion Board could help out in all cases. Hugo comes with specific rules for templates, how to name them, and rules in which order templates get rendered.
It has a nice Theme system, which allows the creation of modular themes. And because creating a theme is easy, there are plenty of good themes available.
Instead of plugins, Hugo uses Shortcodes, which is refreshing. Writing plugins in Jekyll was not fun. With Shortcodes it’s possible to create the same functionality without needing to know Ruby and the Liquid for Programmers guidelines and getting the same result with fewer lines and writing Markup.
Another pleasant thing is the organization of the content. You can create multiple sections and types of content, serving them at your chosen URL. And you can create pages or content out of data (Jekyll has this).
Content is written in Markdown (or Asciidoc, reStructuredText) and can be extended with Frontmatter (in TOML, YAML, or JSON).
Hugo comes with Menu generation and a Taxonomy system, which lets you create as many Taxonomies (tags, categories) as you like.
Converting my site from Jekyll to Hugo took three days. My tendency to over-engineering and perfection allocated a lot of my time. And for that reason, I started simplifying my CSS and Gulp tasks and will further simplify the site. But it was fun and if you need a static site you should have a look into Hugo.