Hugo

A couple of months ago I decided to move away from my Sails.js based blog. This wasn’t because I disliked sails or node but for me, it wasn’t the right tool.

The node process on my server used around 50meg of RAM idling and while I believe this to be normal it made me a little uneasy. I did a test of a simple golang webserver and the memory footprint was under a meg; much better. However, this didn’t make me migrate my site to golang as I hit another little issue whereby I deleted one of my blog posts due to a bug in my back end. As previously mentioned I decided to experiment with backbone for the admin section and instead of deleting the currently active post, I deleted everything which had been edited during that session, whoops.

I needed to fix the bug and probably should implement some deleted state rather than just wiping it from my DB. All I remember thinking was ‘I wish this was in source control’. It was around this time I decided to switch to a static website generator; and I settled on Hugo.

I still write in Markdown which I like but I get to keep everything in a git repo so get proper revision control. Then I just run a quick and dirty script to build and deploy the site (with my server info ommited!):

#!/bin/bash
hugo 
scp -r ./public ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_PATH}

I’ll probably get round to a more elegant deployment strategy but I only have a few files and rarely deploy changes so it’s okay for now.

The only issue I had was that by default Hugo doesn’t have hard line breaks turned on. Or perhaps more accurately Blackfriday has it disabled by default because that’s what Hugo is using. Enabling it is simple enough, just add the following to config.toml:

[blackfriday]
    extensions = ["hardLineBreak"]

That’s all I’ll say on the config side of things, the documentation was pretty good and the above was the only thing I had to dig around for.

The other big benefit, for me anyway, is that everything is offline. Currently I’m writing this on a train without internet connection and I’ll deploy it later…

comments powered by Disqus