Blogging With TextEdit + Jekyll
I thought it would be worth describing the setup I use to run this blog, mainly because I wanted to advocate a system that works much better for my needs than the more popular solutions.
Services like Tumblr and Blogger are nice because they are easy to use, but they don’t provide the flexibility I’m looking for. Cramming a huge block of template HTML into a text field is not my idea of customization.
On the other hand, setups like WordPress, Movable Type, and Drupal take the wrong approach entirely, in my opinion. Most blogs and websites are completely static, so rigging up a PHP/Perl/Java/COBOL/whatever frontend with a relational database to deliver blog posts is like using using a fire truck to water your flower bed (even though that does sound kinda awesome in its own way).
And if wasted CPU cycles and memory weren’t enough, there’s also too much configuration and maintenance overhead with these systems. You’ll need the right versions of PHP and MySQL installed on your server, and your database has to be populated with the right tables, users, privileges, and so on. None of this is rocket science, but it’s another maintenance liability that I just don’t need. And migrating my site to a new host later is guaranteed to be a blast.
Less Is More
It turns out that the simplest, most efficient way to serve static content is … to build your site with static files. (Surprise!) Then all you need to host your site is any ordinary webserver.
Of course, the only remaining issue is a big one – how to manage all of those static pages? Maintaining a whole blog by hand is out of the question if you value your free time (or your sanity) at all.
That brings us to Jekyll. In short, Jekyll is a system that uses a set of input files (templates and content) and spits out static HTML files in much the same way that a compiler produces an executable from source code.
There are a lot of benefits to a system like this:
- Static output. I only need to pay a one-time cost (just a few seconds) to generate my website from the source files, and all I need to do is upload the output to my webserver to publish the site. There are basically no other dependencies, requirements, or overhead of any kind on the server side. Migrating to a new host will be trivial.
- Lightweight markup support. I’m so glad I can use Markdown to write my content; it’s so much more legible than HTML. This means TextEdit is the only tool I need (it even has a spell-checker)!
- Plain text file representation. Although this isn’t a feature of Jekyll itself, the fact that my site’s “source code” is stored as plain text files means that I can manage everything (config, templates, content) with a version control system like git. I can also manage posts and pages by just renaming or deleting files.
- Flexibility. I can still easily style my site the way I want, and keep the content separate from the presentation so I can change my mind later. New blog posts automatically have nice, clean permalinks, but it’s trivial to create individual pages with their own URLs, too. Even generating an RSS feed from scratch is dead simple.
- Simplicity. Last but not least, although Jekyll can do a lot of things, it is a very simple system at heart. This is where a lot of other solutions completely miss the mark.
The nerdy engineer in me is thrilled by a system that does everything I want, does it efficiently, and does it elegantly. It’s a rare combination.