A few week-ends ago I wanted to clean up my Django-powered blog. But it went wrong, and even if everything was under version control, I decided not to use Django for it anymore. Don’t get me wrong here, I still think it is a great framework and I use it for the website of a friend; it is also a nice occasion to play around with Python. However, for my personal blog, I did not want to use a framework anymore, and even less a CMS.

I ended up with plain static html files. But I am not sadistic so I came up with this solution: write entries using markdown then convert them to html. I’d still need something to update my website automatically. Let’s then just use a post-receive hook to run the script. This engine, if I may use this word, is then two, and only two things:

  1. a script to update the blog when there is a new entry

  2. a post-receive hook to automate it

I chose git for convenience, but I could have used darcs as well. I know I am not the first one to have this idea, I think the gitit wiki does it too, but it is not quite widespread. Which is understandable when you see how easy it is to have a blog nowadays. You can argue that I will always need ssh access to my web sever to upload a blog post. That’s true, but anyway I only write them from my laptop. But the main point behind this choice is to get back to the basics and learn more about how a sitemap and a rss feed work, write clean pages, not the ones generated automatically by a CMS or give away my raw blog entries in a database somewhere. I’m quite sure it is possible to retrieve them back, but the time needed to find out how would be the same as writing the full engine.

It took me one full saturday, using Perl, to get most of it working. Messy and clumsy, but enough to go live by the evening. I cleaned it up since, and you can browse it here if you are curious. Nothing incredible, a bit naive sometimes, but my whole blog stands in 200 lines of Perl. And that’s quite good. This is simple, efficient, robust and fun. I learnt a lot in crafting the rss feed and the sitemap.

I drop the idea of enabling comments for now, I’ll see how to add them in due time. I’m quite curious about how a raw post request works and how to incorporate reader interaction in this static system. I’d like to have the comments directly written into the html page, but I suspect I’ll need some javascript here.

The last thing I need to explain: the post-receive hook and how to set up git on the webserver. I found a tutorial that explained exactly what I wanted to do. I just added a call to the update.pl script and that’s all.

So once again, going minimalistic has brought me lots of satisfaction and some knowledge. The funny thing, and it occurs to me more and more often, is that I start to understand the bare concept faster than when using a ‘simplified’ indirect approach, with metaphors, examples, etc. Seems I am getting better at programming after all.

PS: if you have looked at the github page, you may have seen a file named update.hs… that’s for soon.