It seems like only yesterday that I was converting my neglected Slipstream snippets blog to a Wordpress installation. I originally did it so that I could use IFTTT to provide some of the content automatically by pulling in stuff I had posted elsewhere (like Flickr, Pinboard and so on). That was a good idea, and it worked reasonably well, but two things became apparent quite quickly:
- I am really bad about keeping Wordpress updated, and with all the hackers out there trying to spam Wordpress sites, that’s a dangerous game to play. I hadn’t yet been targeted, but my feeling was that it was only a matter of time. You should be able to hit a button in the Wordpress dashboard to update, but due to my particular set up, that wasn’t working and it had to be done manually, which is to say, never1.
- I was never really happy with the styling. Ideally, I wanted to format each of the types of post differently depending on the content. I’m sure if I was better at modifying Wordpress templates, I could have accomplished it, but that was beyond my abilities.
I looked around to see what else might work, and came across Hugo. It’s a static site generator written in Go (a bit like Pelican which powers this blog at the moment), but is blazingly fast to compile, runs from a pre-compiled binary (so you don’t have to have Go installed to use it, or any other dependencies, for that matter), and is extremely flexible. I started out with the Cocoa theme, which appealed to me because it was very minimal, but I have adapted it a fair bit.
I’ve set the site up with different types of content styled in different ways, with much of the information for the layout coming from bits of data added to the front matter of each post. This should make it quite easy to automate eventually, and it keeps the style consistent once the information is provided. You can use the links at the top to browse just the sections of content you are interested in (e.g. all the film reviews), or you can page through all the entries from the front page. This kind of structure makes more sense to me for this kind of site.
I’ve set up my Linode server with a bare git repository for the site, and a git
post-receive hook then automatically runs
hugo on the server and copies the contents of the public directory to the directory that serves the site. This means that all I have to do is write the content, commit it to my git repository, then
git push live master to push it to the Linode server and run it. It’s pretty nice and works quickly. This is where having a static site generator which is a pre-compiled binary works very well: you can just stick the
hugo binary in
/usr/local/bin and that’s all you need to do.
I’m pretty pleased with the way it looks and works. I haven’t yet modified my IFTTT triggers, but I’m hoping to do that after Christmas. My idea is to change them so that they create a Markdown file in Dropbox, pre-populated with the front-matter information (such as links, titles, dates and so on). I can then manually or automatically move them into the Hugo content directory and update the site. It’s not quite as hands-off as before, but it should be very easy to do.
I might even convert this blog to Hugo. I don’t think it would be too difficult to do now that I’ve got to grips with the way that Hugo is structured, and as I have so many posts here it would certainly speed up compilation time. That will also be a job for the New Year, I think.
That reminds me, Merry Christmas and a Happy New Year everyone!
Or, if you are a fan of Peter Sellers’ comedy records, “or in other words, once a year”. A pot of tea at the El Morocco Tearooms to the first person to spot the reference. ↩︎