Julia Evans

Switching to Hugo

I just switched this blog from Jekyll to Hugo! This is a very small thing but maybe you will find it interesting if you find microoptimizing the way you generate your website interesting (like I do, apparently).

problem: Jekyll generated my site slowly. It took, like, 10 seconds! Who has time to wait for that! Seriously. My friends keep telling me that Hugo is really cool and it’s in Go and it will make my site generate in 0 seconds. So I decided to give it an hour and see how far I’d get. I got like 80% there in an hour, and it only took 4 more hours to finish the remaining 20%. Not too bad!

Also I got to delete a bunch of cruft in my website that I didn’t understand. Now I never need to learn to understand it!

My overall review of Hugo: Jekyll was fine. Hugo is also fine. I only ran into one weird bug when working with it today which is pretty good. Hugo is faster, which I like, and it means I don’t need to have a working Ruby dev environment. I couldn’t edit my site once for six months because I was too frustrated to get Ruby to work again. So maybe Hugo is a little more fine than Jekyll (which I pretty happily used for 4 years).

julia’s plan for migrating to Hugo

There is a guide on the Hugo website explaining how to migrate. I did not use this plan. The plan involves migrating Jekyll plugins to Hugo plugins, and who even knows how their Jekyll plugins work? Not me!

step 1: run hugo import jekyll

This gave me a Hugo site with all my content in it, but no theme. Not bad!

step 2: import a random minimal theme

ok, now I can look at my blog posts! They have all the right words in them and are not obviously completely broken. Cool.

step 3: put my theme back

I was terrified of this step. I am awful at HTML and CSS and I do not know how my Jekyll theme works. So instead of trying to reproduce my theme, instead I went to http://jvns.ca, and literally just copied the HTML there into Hugo theme files. Once my site looked right (20 minutes later!) I then figured out what I needed to do to generalize it so that not every page had the same title.

Working backwards from the HTML that Jekyll had generated to come up with a new working theme was way faster than trying to understand what my Jekyll theme files were doing.

step 4: fix everything else that was broken

this included:

  • no RSS feed (along the way I found out that the amazing Andreas had posted a workaround for MY EXACT RSS PROBLEM AT https://github.com/spf13/hugo/issues/1740.
  • all my category pages were broken
  • I needed to rebuild my index page from scratch

none of this stuff was actually that hard. Yay! Hugo seems pretty heavily influenced by Jekyll so the porting was easy.

the hard parts of static site generation

from hardest to easiest:

  1. writing posts
  2. writing HTML/CSS so that they don’t look terrible (I paid my amazing friend Lea to design my site for me. I do not know how to do this at all). But it gets an easier rating because it only had to happen once.
  3. getting my static site generator to work

success

now my site gets generated by Hugo in 0.4 seconds and I understand better how it’s put together from scratch. And now I don’t rely on a mystery Jekyll category plugin that I never understood in the first place. Yay! Some of my CSS is slightly more broken but I’m sure I’ll be able to figure out how to fix it.

You can see the source for this website on github if you want.

There’s also a Rakefile I use to generate it. It is pretty small. The most interesting thing is a new_post task which creates a new post file for me. I stole it from Octopress and modified it pretty heavily to do the Right Thing for me.

2023 update: still fine

7 years later, I’m still using Hugo and it’s still fine. I’m still using Hugo 0.40 (released in 2018) because I don’t feel like upgrading. I really appreciate that Hugo is a static binary so that I can just keep using an old version forever if I want.

https://wizardzines.com uses Hugo too and that also works fine.

What happens when you start a process on Linux? What even is a container: namespaces and cgroups