Hugo On Then, I'll find a better Static Site Generator

October 10th, 2019 - Blogging, Dev, Static Site & Devops

I recently changed this site generation from using Hexo (a JavaScript static site generator), to Hugo (a Golang-based one) and it made me happy for quite a few reasons. Don’t get me wrong, Hugo ain’t perfect, but having a little less JavaScript in my life has made me a happy chappy.

Well mostly, I’m still using it for my asset pipelines for now, so I haven’t yet gotten completely rid of JavaScript compilation, but at least it’s not a part of my content-generation flow any more. Anyways, here’s a roundup of the differences:

The Good:

Simplicity: Hexo, and specifically having a per-project installed JavaScript generator with LOTS of dependencies, made maintenance more messy than I wanted for a simple blog or content-based site. When someone decides to use a static site generator, it’s usually not because they can’t host something more complex (they’re all command-line tools after all, land of the developer), but instead because they want the easy life that a simpler setup provides. Hexo’s many dependencies that needed installing and updating, not to mention its mixed backward compatibility changes over time weren’t nice. I’d almost gotten to the point that the effort put me off wanting to write and publish at all, and that’s not a good thing for someone trying to start a blog.

In contrast, Hugo is a simple, batteries included approach. The generation is a trivial command and everything just works. The standard templating is nice, easy to use and pretty powerful, without me needing to figure out plugins and extensions to make it nicer. Overall, it just works and I now don’t have to think about the technical aspects (JavaScript or Go) underlying the site to be able to write blog posts or even really edit themes.

And, importantly, any updates are a simple brew update away. A little better than JavaScript’s immature package management.

Docs: They better. They supa dupa better. They’re not perfect as they’re a little hard to search through, but they are definitely a helluva lot more comprehensive than Hexo’s. And on top of that the community seems a lot more active as, so far, finding solutions to my theming problems (which admittedly were mostly PEBKAC) was pretty straightforward.

All of the batteries: This is a clear improvement over Hexo. Even simple things like making a decent sitemap.xml with my site structure work in hexo was annoying. Hugo has everything just working great out of the box. It handles all the little things I didn’t even think about, like tagging and rss feeds really well with, so far, no rough edges. Also, as it’s baked on top of Golang’s templating language (which seems pretty decent so far), it handles escaping/different types of outputting really nicely.

The meh:

The not-technically-relevant-but-changing-made-me-rethink-my-approach thing:

Deployment: As titled, this isn’t really relevant to which tool you’re using to generate your static site. But, the act of changing how I generated mine (along with probably some recent workplace devops adventures) lead me to rethink how I was deploying. You see, previously I was lazy. I would deploy the site by pulling the code from Git onto an EC2 instance. This was great in theory, as it meant that I could just checkout the source someone and then run a make script to generate the public output. But it was annoying, because everytime I wanted to publish content, I had to push it, then shell into my machine and pull/regenerate. As time dragged on and server migrations occurred, this became pretty frustrating.

My solution? Rsync & other ancient unix commands! I was browsing Hugo’s docs and came across this pretty simplistic approach to getting my posts & theme changes deployed. I’ve even started making nginx changes by pushing them from my machine over ssh too. This probably isn’t the most repeatable manner when I change servers, and I haven’t yet had to figure out setting the server config up from scratch, but so far I think it’s a winner. Even if the setup is a little turns out to be a little bit more effort (though I doubt it in all honesty), I deploy changes orders of magnitude more frequently than I migrate servers/setup sites. The trade off is most definitely worth it as deploying is so easy now 😆

Things I want to try out next

Conclusion

More updates are definitely to come as I use the setup more, but I don’t think I’ll be going back any time soon (or looking for another generator for that matter). This (along with probably other more real-life-related things) has made writing blog posts seem fun and exciting again so, hopefully I can rave about some fun expansions to this site that I’ve made in upcoming posts 😁