A New Look Leads to a New Blogging System


In deciding to update my blog, I began a task that I knew would be fun and slightly involved. I wasn't disappointed. I created a custom blogging system that leveraged my habit of writing everything in Emacs and my love of Perl. The new system matches my personal workflow perfectly.

I've wanted to update the look of this blog for a while. First, it was getting messy with little ugly bits that had crept in over the years. Second, I wanted two columns instead of three to put more emphasis on the writing. Third, I wanted a responsive design that would look good on a phone, tablet, whatever.

To make these changes I needed to dive into the templates in my blogging tool, MovableType. But as I did that I realized I ought to update the blogging software and MySQL. And maybe, if I'm going to all that effort, I ought to consider switching to Wordpress. Not to mention that tags had never quite worked like I wanted. And so it went until every time I thought about it, I put it off.

The break occurred when I realized that for the way I blog, a database driven content management system was probably overkill. For example, more and more of the functionality on my blog (like comments) was a service. And what dynamic content I am serving, I'm more likely to do with KRL than a new MovableType plugin. More importantly, I write all my posts in Emacs (using some custom elisp and a heavily modified SGML-mode) and then cut and pasted the results into MovableType.

I realized that running the files I was already creating with Emacs through a simple templating system would give me much of what I wanted. And thus began my personal descent into the place every programmer ends up at some point: writing your own blogging tool. :)

One of my primary design goals was to remove the need for a database—I wanted to rely only on the filesystem. The meta data about the posts is kept in HTML comments at the start of the post that my Emacs tool writes automatically. The source files are just that: files in a directory structure.

I wanted the system to be configurable so I could use it for more than one blog. And once I started working on Archives, Tags, RSS, and the homepage, I needed an index. The YAML::XS module did a good job with both jobs.

I picked out a template I liked from {wrap}bootstrap that was based on Twitter Bootstrap and in an hour was generating Web pages from my blog files using the Text::Template module from CPAN.

Bryant Cutler, one of my former grad students, helped out with the logo and background. he was going for a "techno/maker/cyclist/beekeeper vibe." I like what he came up with. All the pictures in the homepage banner are from my personal collection.

Of course, like most projects of this nature, the code turned out more involved than I'd originally envisioned, but I didn't ever get to a place where I felt like a database was needed. I've put my code for generating the blog on Github (about 700 lines of code in all). I don't anticipate it will be all that useful for anyone else since I wrote it to exactly match my workflow, but you might enjoy poking around. But if you'd like to use it and need more detailed instructions, let me know.

The system is remarkably fast (faster than MovableType and MySQL in my old set up). I can regenerate the entire blog (almost 5000 entries) in about 20 seconds. Of course, I usually only generate the current entry which takes about one second (it always regenerates the homepage, RSS feed, recent entries, and so on). I do this on my local box and then rsync pushes it up to the server. If you click around on the server, you should notice it's pretty fast too since everything, including the tag files, is static.

Overall, I'm pleased with both the new design and the new workflow. One of the nice things about being a programmer is that you can build your own tools and customize things to your liking. That's why so many of us end up writing blogging system, I guess.