DEV Community

Prasanna Natarajan
Prasanna Natarajan

Posted on • Originally published at npras.in

Ruby developers! Try Nanoc for your static sites. It's great.

Nanoc is a static site generator just like Jekyll and Hugo.

For my site, after trying Jekyll, Hugo, Octopress and Wordpress, I've currently (hopefully finally) settled into nanoc for these specific reasons.

It uses erb as the templating language. As a ruby developer, this is a boon for me. There's nothing new to learn here as it's just ruby inside of the <%= %> tags. I missed this sorely when I built my site with Jekyll which uses Liquid template and Hugo which uses Go's template which I know nothing of. (And I'm not going to spend time learning either of which in detail because all I want is to write some content in a site tweaked to my needs.)

It allows to have multiple blogs in the same site. I don't know why most people don't need this. It's an awesome feature to have in a personal site.
Putting categories for each in a same blog is not a solution I like. I like to have them separated out. With their own archives page and rss feeds. Nanoc allows me to build separate feeds for these blogs, and also an all-together-in-one-bundle feed as well.
I have 3 blogs in my site right now, all catering to a different kind of audience.

  • The tech blog is where I write about programming stuff. I want to showcase this to my prospective employers. It's also a reference to myself in future about things I'm learning now.
  • The general blog is where I write about everything else. I share it with my friends. Anything goes here.
  • The book notes is where I write reviews of books I've read and have kindle highlights extracted and put on there. I was inspired by Derek Sivers' book notes. I share these posts only with friends who read books.

I host my site in github pages. So a git push is enough to deploy the site. But normally the nanoc repo and the output folder having the static site would have to be pushed separately. But with nanoc's git setup, I just run nanoc deploy and it will create an automatic commit out of the newly built/changed files and then push it too. So the 2 steps are wrapped up in a single deploy step.

Having said that, I'll list some of the problems I faced with nanoc.

  • It's strength is also its weakness. It allows me to build any sort of a blog, which just means I have to sweat out the details of how exactly to bend nanoc to get my needs met. My Rules file took quite some to come up with.
  • I had trouble setting up syntax highlighting. I love to have monokai. But even after following the documentation, I couldn't get it working per my wish. It could be my bad css skills too. But I removed it completely and now rely upon some basic css to highlight code.

If you want more details on how to setup the deployment, the Rules file, multiple blogs and their feeds, checkout the source code at github.

It's a great little tool that assumes nothings and gives you flexibility to build your site to your needs.

Top comments (0)