Moving to nanoc: Part 1

By Max Li | Published: April 20, 2012

I’ve never really liked editing my website/blog. It’s always been so much work. Updating my website has always involved painfully editing raw HTML and/or some common PHP fragments (yeah I know, I should have gotten out of the 90’s over a decade ago). Updating my blog currently involves logging on to the Wordpress admin panel, clicking a seemingly endless stream of links to get to the page where I can add a new post, and then I have to go through some more weird hell to properly tag a new post (I hope for every other Wordpress user’s sake that this last nuisance is probably me misconfiguring something). Well all that bother is now gone for, now that I’ve discovered and am using nanoc. (And very soon, this blog will be using nanoc too.)

nanoc is a site compiler (written in Ruby; it’s also open source if you’re interested in contributing). Huh, what’s a site compiler? Well basically it takes your site content (written in HTML, Markdown, Textile, or whatever) and it puts that content into a layout you’ve defined, generating a static HTML page. That’s somewhat of an oversimplification, you can also write some Ruby to customize exactly what each page contains. I’m not going to describe it further; one of the reasons I chose this particular site compiler (as opposed to something like Webby or Jekyll) is that it has great documentation; check it out if you want more details. (In case you’re wondering, I also chose it because the creator Denis Defreyne recently appeared on the always awesome FLOSS Weekly and basically sold me on nanoc before I knew too much about the alternatives (probably not a great reason, but I still think I made the right choice).)

The transfer process was pretty seamless. I just copied the overall site structure into a layout file, with a separate file for each of the header and footer which was previously included via PHP. I spent most of the time manually converting the site content into Markdown (and fixing typos which had been terrifyingly present for who knows how long).

I’m quite glad that I’ve done this. It’s given me a chance to (marginally) improve my Ruby skills, and now that my site is completely static, it’ll probably load a bit faster (though the pages were so tiny for that it probably doesn’t matter). Since I host the website on, once I convert the blog I’ll be able to save a few cents per day since I’ll be using significantly less storage space (not too sure why Wordpress needs nearly 100 MB of disk space) and I won’t need PHP (not a big deal, but hey, I’m a poor university student).

Stay tuned for part 2, where I discover how painful it is to convert something a little more complicated in my blog (hopefully it’ll be painless).