Create a multilingual website with nanoc

Posted by Eric Scheibler at September 10, 2014

Last year I've converted my blog to Octopress, a static website generator. Although I appreciate the general advantages of a static website generator I miss two features now:

  1. Octopress doesn't support multilingual websites
  2. It's mainly for blog's. Other website layouts are difficult to realize.

The layout adaption would be fairly time consuming. So I searched for an alternative website generator which allows a more flexible design. I found what I searched for at nanoc. This article contains the created nanoc theme for this website.

Main features:

  • Creates a website with a horizontal navigation bar on top of the site
  • Content and layout are separated strictly.
  • Write articles in Pandoc's markdown dialect.
  • Implements multilingual support based on this tutorial.
  • Optional layout to create a simple blog.
  • All sites use HTML5 tags.
  • Filters for creation of a table of contents and to include content of a text file.
  • The theme is accessible for screen readers.

Next follows a short installation guide. A working Ruby environment is assumed. Further information about installation are available at my theme's Readme file and here.

Install necessary gems and clone the repository:

$ gem install --user-install rake nanoc adsf pandoc-ruby listen iconv builder stringex
$ git clone https://github.com/scheibler/nanoc-multilingual-theme.git

Rename folders:

cd nanoc-multilingual-theme
mv content.example content
mv nanoc.yaml.example nanoc.yaml
mv rules.example rules

Next adapt the contents of the files nanoc.yaml and rules to your needs and compile the site:

rake

The following command also performs some checks at the compiled website and pushes it via rsync to a remote server:

rake all

If your website contains a blog, create a new article with this command:

rake new_post "Deutscher Artikelname" "English article name"