Static blog generators are the next big thing. I've been using Wordpress in one form or another since 2005 and I also spent a bit of time working with Drupal. They both seem to work fine, and I wondered what all the fuss was about.

So I built this blog using Pelican.

For those who don't know, static blog generators like Pelican create HTML-based sites complete with posts, tags, pages, blogrolls, feeds and, if you use a third-party service like Disqus, comments. The beauty is there is no database and the site doesn't have to be generated by a server. It sits there in the form of HTML, CSS and JS files, just waiting to be read.

The magic happens locally. You write your posts and then use a static blog generator, which is installed on your laptop or desktop, to build your site. You then push the static site files that have been created to your server and you're published.

Want to add another post? Just write it, save it, generate your site again -- you run a script to do this -- and push the updated files to your server. The features and design of the blog are customized by editing the generator's code and are reflected in the site files your generator creates.

This seems like a lot of work compared with simply uploading your Wordpress or Drupal installation once and then adding content through an admin interface. So, I'm sure you're asking, why bother?

Well, there are some pretty significant advantages to the static approach:

  • You can write in your favorite text editor. I drafted this post in TextMate using Markdown, which Pelican turned into HTML.
  • Security is improved as the data and code used to generate the site are not on the server, they're safely tucked away on your local machine.
  • Loading is very fast as your blog is now simply an HTML-based site.
  • Customizing and deploying the site are fairly simple. Pelican generated this entire site in 0.7 second.
  • Free hosting is readily available, as there's no need for database or computing resources. This blog is hosted free on GitHub, which anyone with a free account can do. There are other options as well.
  • Of course, the generator code is open source.

Importantly, there are plenty of static blog generators already out there, catering to many different tastes in programming languages. I'm a fan of Python, so I chose Pelican. Here's a quick list of the generator projects I looked at before deciding to proceed.

  • Pelican (Python)
  • Jekyll (Ruby)
  • Hyde (Python)
  • Octopress (Ruby)
  • Nikola (Python)

In fact, I recently found a site that lists dozens of these projects in many languages in addition to Python and Ruby including JavaScript, Go, Haskell, PHP, .Net, Clojure, Java, Lisp, Scala and OCaml.

Am I arguing that everyone should move their blogs over to static generators? No, that would be a mistake. However, for those who know some basic coding and want to find a way to blog that offers the advantages listed above, I'd definitely give it a shot.

It's actually a lot of fun.


Comments

comments powered by Disqus