Using Hugo

Published on 2020-02-28

Before working on this site, I had experience working with Ruby on Rails from a university course project and Symfony 4 from developing the site of CenEka, a student organization I was part of. Both are frameworks that allow you to quickly cobble together a good web application. So the easiest way to develop my own website would’ve been to use the Symfony framework since that would be the framework that I have the most experience with. But rather than sticking with what I knew, I tried something new.

Static versus Dynamic

There were a few things that this site needed to be. Most importantly it had to be snappy. It also should be as minimal as possible without sacrificing looks or functionality. And it needs to be easy to maintain as well.

To get the snappiness and minimalism, a static site seemed to be the way to go. For the purpose that the site would be used, There’s not really a need for any server-side processing. It was necessary for the CenEka website, as the ability for students to register and subscribe to events seems fundamental for a site of a student organization. The trade-off is that it might take a while for the site to load, especially if you try to reach it from a different continent from where the site is hosted.

The only thing needed to load a static site are a couple of files that might as well be cached close-by. There is no need to wait for a specific server or servers to finish constructing the HTML from templates and local data, the HTML is already ready to go. An added benefit is that hosting for static sites is mostly free. So all I needed to do was write some HTML, write some CSS, upload it to something like Gitlab Pages and I’m done.

Starting with Hugo

I first heard about Hugo randomly online from someone named Chris Titus through a Youtube video I happened to stumble upon.

His accompanying guide (and many other similar quick-start guides) seemed to be more targeted to people who use Wordpress and the like. They all start with some sort of template or pre-written website and modify that. But I wanted to write my site from scratch to make it (hopefully) stand out a bit more and for learning purposes. So I skipped all quick-setup guides and went straight to the documentation.

When I started to slowly get the hang of it I got annoyed by a lot of the choices made by the developers. A lot of the syntax and naming of variables or even the whole variable system felt a bit counter-intuitive. There were multiple times that I thought: “I got this now!” to then try something new out without reading the documentation only to spectacularly fail and having to read the documentation anyway. Also, I dislike the date formatting strings, but that is more a complaint for the Go developers I guess.

Eventually, I started to understand it better. And it feels pretty comfortable now.

Loving Hugo

So now, I would recommend hugo for building sites that don’t necessarily require server-side processing. It’s easy to install: on Arch Linux, as on most distros I think, it is present in the official repos. If you’re not that fixed on not using pre-build sites from github, it is easy to set-up and start working.