Why use HuGo?
As you may already know the site uses HuGo. In this small article I’ll give you the bird’s eye view as to what that is in particular and why this appealed to me.
So to quote from the project behind HuGo:
Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.
In layman’s terms what that means is that I get to write all of the site content (including this very article) in Markdown. HuGo then compiles it into and CSS HTML which can be served from anywhere. Of course there are some more bits and bobs there as well, but that is the core of what this Golang built tool does (I might go into further detail in future). “What’s so great about that?” I hear the imaginary voices in my head ask, “Why not just use Wordpress and type stuff out in Gutenberg?”
Well my overlycritical imaginary friend, there are a couple of things that make this easier.
1. Compiling files Link to heading
In all honesty this is quite a retro aproach to doing things. Everything now seems to be a microservice where you get pre-compiled a container(s) of software or interpreted. Why would you want to compile files?Simple, because once you compile it, the server doesn’t spend time doing so. All it has to do is serve HTML which isn’t computationally expensive. I can then take my files and do whatever I want with them, leading me on to my next point:
2. Automation Link to heading
This was the biggest pull the HuGo set up had on me. All I need to do is write the source files, compile them and I can then put them in some SCM (like GitHub) where a server can get them. Even the source files lend themselves to being put in some SCM, making traking changes and having backups a breeze. Of course there are even easier ways to host sites built like this (I go into further detail in my own process here) but it is often simple things that allow you the greatest amount of freedom, due to their low-specificity and having less moving parts.
Take for example a Wordpress site, as the world’s most popular CMS, just in order to host it I need:
- A web server - it needs to be chosen and configured carfuly based on your use case
- A PHP interpreter - you need to choose a version that works with the plugins you want, then it needs a plethora of adjustments just to make sure it spawns the right amount of child processes, then you need to allow it to upload more than 2MBs and the list goes on and on
- A database server - Since all of your posts and actuall data will live in MySQL, you need to ensure proper configuration, resource allocation, security and everything of this server.
- Some sort of custom theme to make it look nice, which tend to be the most common attack vectors as they are not kept up to date and also may require you to pay for using them.
- Potentially plugins which opens up security and financial questions again.
Automating all of this is a nightmare, so when you do need to move say web hosting providers you need to ensure everything matches up between both sides prior to moving your files. Let’s say you want to upgrade plugins, then you need a staging site to ensure everything is working without risking the site going down. Don’t get me started on keeping your actual site content version controlled and making sure that you can quickly revert changes. All of this takes time and I hate wasting time..
Where as for HuGo what I need is:
- A web server
Everything else in the process is just fancy ways of getting your files to a server.
Now don’t get me wrong, CMSs (CMSae?) like Wordpress still have their place in the world. For anything more complex than a blog, a cookbook site, a simple “card” website doing it with just HTML and CSS is going to be a pain. That’s the nature of static sites and some times you want some dynamicism. All I’m saying is that some times it’s worth asking “Does my site really need to be dynamic?”
3. Markdown is actually easy Link to heading
So this is a small thing, but once you get used to it, you don’t want to use GUI editors anymore. It has been fascinating to me how little you actually need to spruce things up in order to make them look good. Sure I’ve used markdown in the past but I had forgotten how intuitive it is. The guide is basically 1 page and that is all you need to learn really.
In conclusion Link to heading
The simple things in life are often the ones that give me the most joy - going out for a nice walk or ride, having a nice meal or writting posts in Markdown, compiling them with HuGo to HTML and hosting that HTML. I find it quite freeing that I can do whatever I want with my site without having to fiddle with other people’s code or struggle to make it as easy as possible through automation. All I want to do is sit down, type out an article push it to SCM and have it pop up instantly in the live/staging site and with HuGo I can do just that.