Migrating to Hugo

After trying Jekyll (not being a Ruby developer, the Ruby ecosystem is a pain for me) and Metalsmith (which worked well until I updated and my plugins broke) I decided to look for a static site generator that better suited my needs.

Enter Hugo. It’s very fast, easy to install and does everything I want out of the box!

The best feature IMHO is the built-in server which, coupled with impressive build speeds, means that I can edit, save and instantly see the results. I know there’s Markdown editors / preview plugins out there but Hugo includes the whole site, not just the markdown.


As I was already using markdown and my site isn’t very big it was quite easy to move everything over. Just copy the files, add a few tweaks to the posts front matter and that was about it.

I did decide to create a new theme which was fairly easy to do. The most useful thing I found from doing that was this snippet:

{{ printf "%#v" . }}

Which prints all the variables in the current scope. The dot can also be replaced with a variable to print all it’s values, e.g.:

{{ printf "%#v" .Site }}


Currently, I’m using Disqus for comments but the inability to remove or easily merge threads, plus the privacy issues, makes me wish there was a better alternative. If you do know of one please let me know!

To give me the ability to disable comments on a post by post basis I’ve added an extra check to my Disqus layout:

{{ if and (.Site.DisqusShortname) (not .Params.disable_comments) }}

Normal code to include comments here

{{ end }}

Now to disable comments on a post all I need to do is add disable_comments: true to the front matter.

Syntax highlighting

For syntax highlighting I’ve decided on Prism which is quite lightweight and uses the semi-standard language-* class. Luckily Hugo also uses the language-* class so everything works out of the box.

I wasn’t very keen on the default Prism themes so I’ve created a couple of custom themes for it:

Prism Monokai theme

Monokai DemoMonokai CSS

Prism Github theme

GitHub DemoGitHub CSS


So far I’m very pleased with Hugo. It’s fast, easy to use and makes previewing new posts (and any other changes) quick and easy. My only complaint is the documentation could do with a few improvements.

Should you switch? If what you have is working well for you then probably not. If, on the other hand, you’re like me and looking for a new static site generator then Hugo is definitely worth trying!