Rewriting codeinthehole.com

Note, this article was published over 2 years ago and hence the content may be stale. Consume with a pinch of salt.

I rewrote this blog recently with the following aims:

  • to make it as easy as possible to create a new article, using reStructuredText (RST) as the base for each article;
  • to clean up and simplify the design, focussing on the readability of articles that include code snippets.

I knew that there were various static blogs out there, with many supporting RST, but I still fancied the challenge of crafting something specific to my needs. There's nothing wrong with wheel re-invention if you want to learn about wheels.

This article is a short summary.

Technology

Django, Fabric and pygments - the source is on github. I intend to pull out the generic blogging code into a separate library, reStructuredBlog, at some point, hence the "rsb" acronym used in the codebase.

Writing a post

My ideal for writing a blog post is:

  1. Use vim to create a .rst file for the article;
  2. Preview the article locally;
  3. Publish to the remote server

This translates to:

Write

vim posts/my-new-article.rst

Preview

./manage.py rsb_article posts/my-new-article.rst
./manage.py runserver

This converts the RST file into a instance of rsb.models.Article, plucking out the title, subtitle and any tags in the process.

Rinse and repeat the write and preview steps until happy.

Publish

fab prod publish posts/0036-my-new-article.rst

This copies the RST file up to the remote server and re-runs the rsb_article management command to create the article in the production database.

Design

/static/images/bookcovers/9781119998952.jpg

I recently read the excellent "Design for Hackers" by David Kadavy. Duly inspired, I attempted to rework the design to be clean and pleasing on the eye. The color scheme is deliberately kept simple; the fonts used are Verdana, Droid Serif and Inconsolata.

I was also influenced by the clean look of the personal sites of Steve Losh, Zach Holman and Armin Ronacher.

Overall

I'm pleased that:

  • The site isn't painfully ugly like the old;
  • I can write articles easily and using my favourite tools (vim + RST);
  • I can write articles on the tube on the way home;
  • Github is now my backup of both code and content. For instance, you can view the source of this article.

Since I switched to Disqus for comments, I decided to drop all the old ones (not that were that many), since I wasn't sure it was possible to migrate Apologies to the comment authors.