How to blog like a hacker

NB This was supposed to have been published last week, but WordPress ate the original draft I wrote and it took me a while to get the motivation to write it again. But it’s done now. Enjoy

Self-published content on the web has exploded and many of the millions of blogs out there are run on content management systems like WordPress, Blogger, MoveableType and LiveJournal. These are all robust software products that have survived years of rigorous field testing and offer a wide variety of features and customization options. They are good tools which offer a wide variety of customization options and other features. However, to those of us with a more do-it-yourself bend, it can sometimes seem that these systems do a bit too much.

Most of these systems provide dynamically generated content (MoveableType has a static option). The actual content (like posts and comments) is stored in a database and the actual HTML pages are generated on the fly. This makes things like templates and themes simple to use (as you don’t need to regenerate thousands of pages for each change), but it also means that you need to use considerable CPU for every page load. This can be problematic if you have a busy site or traffic spikes. CMS’s also offer a wide variety of features besides just running a blog or website. They allow RSS, comments and a variety of media features. While some people certainly use all these features, it can be overkill for others. Sometimes all you really want is to be able to write some text with an image or two and put it online in a quick simple way.

There are other, perhaps more esoteric reasons for wanting to run your blog without a modern CMS. You might want to have complete local access to your data and web interfaces for writing blogs might not be to your liking. Some people swear by flat files and their favorite text editors and they both have their own advantages. Flat files are simpler to browse about that depending on an interface to a database and certainly easier to move around. Advanced editors like Vim or Emacs can make the job of writing more efficient, especially if you’re already used to them. Popular version control systems like Git can make sure that your data is kept backed up and safe and can be used to keep things synced between a local machine and a server.

A combination of all the above factors has led to the creation of a number of ‘static site generators’: tools that take simple local files (generally plain text with some simple markup) and turn them into full HTML pages after applying some sort of template. You can keep the original source anywhere you want and just transfer the generated, static HTML to a server for the world to see. The original “Blogging like a hacker” post was written as the announcement of a popular static site generator called Jekyll. Jekyll is written in Ruby and is used to power the GitHub Pages online publishing system (it was written by one of the GitHub team). There is a Python clone of it called Hyde (fittingly enough) and a Perl program called Ikiwiki does a similar but integrates a version control system and is meant to be deployed on a server.

I’m not going to pretend that static site generators are the best fit for all or even most bloggers and web writers. In fact, I would suggest that static site generators are you’ most useful for those people who value simplicity and control more than anything else. Using a static site generator well requires at least working knowledge of HTML and CSS and a good text editor. Using a version control isn’t a necessity, but it seems to be that being able to use a VCS is one of the big attractions of static site generators: you don’t have to rely on whatever draft system your CMS provide, but rather you can use industry standard version control tools to keep your work safe.

I’m a fan of practicing what I preach, so I’ve been using a static site generator as well. I’ve personally be using Jekyll to manage a personal site for the last week or so. I think it’s the simplest such tool to set up and has sufficient features to create some pretty good looking websites. That being said, I don’ t think I’ll be moving this blog off WordPress any time soon. WordPress suits my needs well enough and converting almost 250 posts from WordPress to plain text is not something I want to spend my time on at the moment. I export the blog weekly and keep the resulting XML file under version control to be safe. I think of it as a sort of middle ground between having everything hosted in a remote server database and having a locally secure version of everything.

As I continue writing and using software, I’m coming to realize that the best tools are the ones that can be molded to your needs. Static site generators attract users who aren’t afraid (and might even be eager) to get under the hood. It’s the same sort of mentality that attracts people to open source software and systems like Linux: the ability to tinker to your heart’s content until you have something that is just right for you. If you are someone who gets can spend hours setting up your computing environment to be just the way you like it, then you’ll probably like working with static site generators. On the other hand if you couldn’t care less about what goes on when you hit the ‘Publish’ button, thats fine too. Use WordPress or something similar and just focus on writing great content.