This is my first blog post, and I thought why not, a fitting subject would be using Hugo to run my static site. And when I say first post, I really mean first. I’ve never written posts before, so this is relatively new to me :)

This isn’t going to be a guide, so I’ll definitely have skipped details, put things out of order, what ever. You’ve been warned :)

Hugo is a static site generator written in GoLang. This is the first time I’m playing with it, and am really impressed so far!

Installation

Installation was actually pretty simple. I run macOS so for me, it was as simple as running brew install hugo

The first thing I did was run through the Getting Started section of the hugo docs. I went through a few themes, before I found one I liked, and then spent a lot of time trying to figure out how to get pages to generate.

Always. Read. The. Docs.

This may seem obvious, but there is a lot of useful info in the docs, and sometimes it takes more than one reading to get all the information you need.

Themes

This had me stuck for a bit, but it became clear what one has to do, after looking at the provided example site. There’s still a lot to do, to get everything displaying as I want it. I’m really not a frontend dev, I can’t even begin to describe how painful it is for me to do web/frontend’y stuff.

Templating

The templating engine is, interesting. Not really sure if that’s a good or bad thing yet. I have a lot more experience with Twig, or Jinja2, this GO templating language feels so foreign.

Conditionals are strange, they certainly don’t work the same way as I’m used to. Instead of doing something like:

{% if someVar > 1 %}
    ... do something ...
{% endif %}

In this templating language, it’s done as a function with arguments:

{{ if ge .someVar 1 }}
    ... do something ...
{{ end }}

I honestly feel like this is way less readable. Maybe I’m just too used to how it’s done in other languages.

Content

Besides frontend stuff, generating content is quite easily the most painful part of the whole process. I’ve never been particularly good at filling a website with content, for the most part, that’s been someone else’s job. But here I am, writing things. Look at me go.

Deployment

Deploying is pretty easy. The site is in a git repository, and I have a Gitlab installation where I store the project. From there, I have a push hook, that calls up a webservice that kicks off the deployment process. At the moment, the deployment process is as simple as a git pull, build with hugo, clear out the webroot and copy over the contents of public/. This could definitely be better, with symlinks and dated release folders, but I honestly don’t foresee this ever being an issue with this site.

Conclusion

Well, certainly not the best blog post in the world. But it served its purpose of being the first, and giving me something to do while I got started using Hugo. All in all, I’m pretty happy with Hugo. It takes some getting used to, but makes maintaining my site pretty easy with a very limited software stack needed to run it.

Back to blog