December 12, 2018

Hugo Static site generator

This post marks tmoving this blog to Hugo , the static site generator written in GO. Yes I’m still a fan of static sites, this blog had been using a static site generator since 2015 Pelican

Why a static site generator? Static sites of this type have a number of advantages over more conventional CMS systems.

  1. Unhackable. Forget wordpress security updates and mysql injections. The only way someone is modifying your site is if they have your upload credentials.
  2. Fast. Once generated, there’s no work done on the web server side.
  3. Cheap. Static sites don’t need a server running 247. Host them on Amazon S3 for free. (only pay the bandwidth, which you would have paid on top of your hosting cost anyway)

Static sites created by a generator share the main benefit of their heavyweight CMS cousins. Separating content and presentation. Themes can be applied, changed and updated to change the look of your site, add new features, control ads, or manage navigation without affecting your content. Content can be usable, unmodified for years to come. What they don’t have is the friendly online editing/authoring interface of a CMS. Instead you write plain text files and put them into a directory for pickup.

Why Hugo? I did first try Jekyll, then the most popular site generator with the biggest community. It’s easy to install, easy to use. But to theme and modify it I needed to learn ruby and the liquid template engine. Time is scarce these days and learning a new language for a home project seemed like a big ask. Then for a number of years Pelican was the tool of choice. Pelican uses Python and the Jinja2 template engine, my then favourite language and the same template engine as used in the flask web app framework that I’d been playing with. Both as a learning exercise and time to result, it’s was more efficient. However, there are simply more tools and adons available for |Hugo|(https://gohugo.io) nowdays and not wanting to write my own plugins for pelican was preventing me from updating the blog content.

Plain text files? How do I format? You use a text based markup language, like Markdown This is a simple text based markup system that allows (forces?) you to concentrate on your content, not on layout, font sizes or other distracting things. Personally, I like this, it’s clean and elegant. It fits with the sprit behind the semantic web. And speaking as someones who’s done hundreds of database migrations and restores, you really don’t need a database for your personal blog. Flat files are much more robust and easier to work with.