July 12, 2015

Pelican

This post marks the return of this blog to Pelican , the static site generator written in Python.

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 Pelican? I did first try Jekyll, 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. On the other hand, Pelican uses Python and the Jinja2 template engine, my favourite language and the same template engine as used in the flask web app framework that I’ve also been playing with. Both as a learning exercise and time to result, it’s more efficient.

Plain text files? How do I format? You use a text based markup language, like Markdown or restructured text. These are simple text based markup systems that allow (force?) 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.

edit: And just for Steve…

Pelicans Photo