The last time I switch to static site generator, it was for Hexo. While it worked just fine for my use case (I don’t blog that much anyway, to begin with), I began contemplating to switch to something even simpler. Enter Hugo. For the uninitiated, Hugo is a fast and modern static site generator written in Go.
Compared to Hexo, Hugo is only a single executable that you can download based on your platform. It is a very welcomed change for me, gone are the days of managing dependencies of your static site generator. Now, whenever a new version of Hugo is released, I just need to download the new executable and replace the old one.
Running Hugo globally
Now, if you are using Windows like me, running
hugo command globally requires a bit more work. What I usually do for single executable file, is to place them in a specific directory in
C: drive, in my case, I use
I’ve been burned so many times before with various problems in Windows, when using command line (paths longer than 260 characters, space in folder name, and so on), so using a simple directory name like
bin seems like a logical choice for me.
Once you have moved
hugo.exe to the
bin folder, you’ll need to add that directory to system path. Here is article on How-To Geek on how to do exactly that.
Concept of Hugo
While Hexo and Jekyll position themselves as a somewhat blog-aware static site generator, Hugo tries to be more flexible with contents that it generates. Sure, we can use Hugo as a blogging software, but with recent release of v0.20 opens up endless possibilities of what it can generate.
Hexo and/or Jekyll require you to organize your post in a specific manner, and they have much functionalities focus on blogging.
On the other hand, Hugo lets you decide whatever way you want to manage your content, and that includes blog post as well. It is not restrictively revolved around blog functionality only, but is also perfectly capable to be extended to serve different kind of site.
For me, three most important concepts that you need to familiarise, if you decide to migrate to Hugo, is:
If you intend to use 0.20 or newer, please have a read on Output Formats as well. That’s where Hugo really excels compare to other static site generator.
Hugo offers a vast range of themes to choose from, but there isn’t one that really catch my eyes. Initially, I decided to use Cactus theme, but I kept overriding the template, and changed the styling each days to suit my liking, so might as well I build one from scratch.
It is a great learning opportunity to build the theme from scratch. I’ve been looking forward to learn Go for quite some time now, so I consider learning about Hugo theming is the first step in the right direction for me.
The very theme that I used on this site, Harvey is the product of my experiment with Hugo theming.
You will notice some familiarity of Harvey with original Cactus theme. I decided to keep what I like with Cactus, but enhanced it with what I need. For example, the homepage consists of an introductory text and selected list of recent posts, instead of list of posts in Cactus.
I have also created a dedicated archive page, which displays all posts separated by year. No avatar in header is displayed, as well as social icons in the footer.
Harvey do not support taxonomies (categories and tags), as well as pagination. It’s a conscious decision that I’ve made because I don’t see myself using that particular functionalities yet for this blog. Feel free to checkout the Github repository for Harvey for installation guide and further details.