Customizing Nikola's default template


Posted:

First things first

Nikola comes with several template options built-in.

The default template that comes with Nikola is a basic HTML5 template created with bootstrap. This in itself opens us to many possiblities - responsive design, grid layout, widgets, etc.

Nikola also offers an option to import stylesheets form bootswatch(which itself is built on top of bootstrap), allowing for very simple custimization.

How it works

After creating my site

nikola init nostradamnit

I declared my default template to be bootstrap3 in the config file. Next I just had to customize the template with this command

nikola bootswatch_theme -n slatestrap3 -s slate -p bootstrap3

which basically says take the bootstrap3 theme, make a copy named slatestrap3 and then copy the slate theme csses from bootswatch.com

Or not

However, it didn't work. It errored out :

ConnectionError: HTTPConnectionPool(host=u'slate', port=80): Max retries exceeded with url: /bootstrap.min.css

Luckily, this being a Python framework, I was able to open the source for the action and figure out what it was supposed to do, then complete it by hand.

All I had to do was create a text file named parent in the themes/slatestrap3 folder with the name of the parent theme, then copy the new files to the correct folder (which was correctly created). Then modify the config file to declare the new theme, et voilà, new theme activated.

Comments powered by Disqus
Share