Using Markdown and Hugo to generate my blog

2021-06-28

Ever since I set up this blog earlier this year, I’ve been looking for a site generator that can parse Markdown files, because writing blog posts in HTML is a bit tedious. Elements like headers and footers have to be copied manually into every new HTML page, as well as their changes, which increases the amount of maintenance. Sure, I could just use WordPress or similar server side Content Management Systems, but I decided against it, as it adds unnecessary bloat and security risks.

Completely unrelated to this blog, I’ve started learning Golang some weeks ago, because my university professor recommended us to learn a new programming language every semester. So after C and C++, I’ve decided on Golang for my 4th semester (I didn’t learn a new language in my 3rd one oops). While I was looking for some Golang introduction videos on YouTube, I stumbled onto this video, where the speaker talks about common mistakes in Go using code snippets from Hugo, a static site generator. I decided to check Hugo out.

It turns out that Hugo is pretty great! After reading its documentation, I installed Hugo with Chocolatey, a package manager for Windows. Setting up a basic website and moving my content and structure to Markdown was pretty simple. Overall, it took me around 8 hours from installation to production. I especially like the following features:

  • Easy initial setup
  • Powerful features to customize the website
  • The directory structure of Markdown files translates directly to the URL structure
  • Export to RSS, which contributes to a minimal, bloat-free web
  • A wide variety of community themes with easy installation, very handy for non-frontend people like me
  • Fast generation (my website takes around 120 ms)
  • Netlify (my current host) integration for automatic builds

In the beginning however, I struggled a bit with the amount of customization parameters and generation options. To summarize, if you’re looking for a static, bloat-free website or blog, don’t want to write the HTML files yourself and don’t mind reading a bit of documentation, try out Hugo and see if it works for you.