Migration to Hugo

Mar 7, 2017   #deployment  #docker  #hugo  #jekyll  #lanyon  #victor 

It’s a requirement that anyone who moves a blog from Jekyll to Hugo write a post about their migration. I’ll do the same and will also talk about Victor, the Hugo equivalent of Lanyon.

Why

I was pretty excited about Jekyll (as I mentioned in my previous post); however, I quickly came across a common problem: it is slow to build. I read some accounts where it could take minutes, as your site grew and you added things like tags and categories.

My site is still pretty simple with less that 50 total posts, but when I deployed with Lanyon, there was noticeable downtime. I originally figured that this would be mitigated in a live scenario using a load balancer and blue/green deployment, but this slow build process was also affecting local development. I decided to see what other options were available.

Hugo

As I researched ways to speed up my Jekyll builds, I discovered Hugo. The number one reason I read that people migrated from Jekyll to Hugo was because of build speed.

I missed Hugo in my initial static site generation tool investigation because I was focusing only on moving my Tumblr-based site. Hugo doesn’t have its own tool to perform Tumblr migrations though there are external tools that do it. I was initially sceptical that Hugo was really an improvement. I was so wrong! I converted my Jekyll blog and tried it out. I originally thought that something had gone wrong because it was so fast. In addition, it had pagination and had support for tags out of the gate!

I found a theme I liked and easily extended it to my liking. I also built out a tool similar to Lanyon called Victor. Victor was an even simipler Docker image since Hugo has no dependencies!

One feature that I haven’t been able to get working correctly is Hugo’s excerpt handling. Jekyll was elegant, but Hugo seems to just dump the first 70 words (I think?) without any of the HTML formatting. This makes my blog list pages not as nice, but it’s a feature that I’m sure either I’m not handling properly, or will be fixed in a future revision. The advantage of being able to use my tags and having a near instant build is worth it.

Victor

Victor is a Docker-based build system that works like Lanyon. You provide a Git repository URL and an base64-encoded SSH key in environment variables and it will pull down the repo and build the static site on first deployment. Nginx serves up the static content keeping it all lean and mean.

Using Victor, I haven’t been able to kick off a build and see my site become unavailable. It is theoretically possible to see my site become unavailable, since I do have to pull the site from Bitbucket, but so far it’s been too fast for me to personally observe. With Jekyll and Lanyon, I would see it become unavailable with every deploy.