by Jonathan Rothwell

A static site with nanoc

I enjoy writing stories. This is a hobby that I’ve had for as long as I’ve been able to write. I don’t pretend to be very good at it, but hey: it’s for my own amusement.

So far, the only story I’ve posted on the internet is The Arrow of Time, a short story I wrote for a writing competition at college that enjoyed some minor success. This has been languishing at my old web site at for years, stubbornly refusing to be migrated out of my general laziness.

I didn’t want to move Arrow to the Octopress site you’re reading now. Octopress is great, but it’s mainly geared towards writing blogs (as is its foundation, Jekyll.) For unchanging content that won’t decrease in relevance over time, Octopress is not ideal.

With this in mind, I went in search of an alternative, a system that would generate a static site that would live at the URL of

With this in mind, I went in search of an alternative. I briefly considered rolling my own static CMS in a language such as Go, or Java. I quickly discounted this once starting: even the process of writing code that would filter for embedded tags for the post content proved to be a deceptively large amount of work for something that was bound to have already been implemented.

Eventually, after investigating several alternatives, I settled on nanoc. Like Octopress, nanoc is written in Ruby (a language I only have a rudimentary knowledge of.)

However, it fulfilled two of my main requirements: it was easy to get started with, and it didn’t assume you wanted to write a blog. And when I say it’s easy to get started with, I’m not making one bit of it up—it can be installed using RubyGems on any PC with a functioning Ruby installation, and to create a site’s staging area all that needs to be done is this:

$ nanoc create-site foo

With a very small amount of modification to the Rules and config.yaml files, nanoc can be cajoled into compiling Markdown source files using a processor such as kramdown. It supports embedded Ruby (or erb) in its input files, which ultimately turned out to be very convenient: the new site has an index of the stories on the site.1 This is generated using embedded Ruby in the source file, which iterates over all items of kind story and sorts them by date. (In practice, this used a bit of code pinched from nanoc’s own Nanoc::Helpers::Blogging helper, separated into its own helper to keep the compilation overhead low.)

With a bit of testing, coding and styling, a lick of paint from Subtle Patterns and a free trial from for stats, I had a fully functioning site within seventy-two hours of on-off attention (in practice, something like six hours of coding and testing.)

So now, with a functioning (and very empty) site for my writing, I’ve come away highly impressed by nanoc. The process of creating my site was quick, convenient, and just hands-on enough to be fun.

I promised myself sometime last year that come 2013, I’d start writing a new short story every week, and post it on the Internet for folks to eviscerate at their leisure. The fact that creating was so easy has eliminated one of the last remaining excuses I’ve had for not doing this!

So, in summary: I will do my best to do something I enjoy (writing stories for your entertainment), and if you need to create a statically-generated website that isn’t a blog, nanoc is the tool you should use.

  1. At present, there’s only one, but trust me, it works!