#+BEGIN_COMMENT .. title: Modifying a /Nikola/ theme .. date: 2020-09-01 20:00 .. slug: modifying-a-nikola-theme .. updated: 2020-09-01 20:00 .. status: published .. tags: nikola, theme .. category: misc .. authors: Elia el Lazkani .. description: I needed to make a few changes to the theme I am using for my blog with /Nikola/. Here's how to do it. .. type: text #+END_COMMENT After publishing my /blog/ in new form yesterday night, I have received some suggestions for changes to the theme. First off, I noticed that the footer is not showing after the blog was deployed. That reminded me that I have made changes to the original theme on disk. The pipeline, though, install the theme fresh before deploying the website. I needed to fix that. Here's how I did it. {{{TEASER_END}}} * Create a new theme This might be counter intuitive but /themes/ in /Nikola/ can actually have parents. So what we need to do is clone the theme we want to modify while keeping it as parent to our theme. I'll show you. First, create your new theme. #+BEGIN_EXAMPLE $ nikola theme --new custom-willy-theme --parent willy-theme --engine=jinja #+END_EXAMPLE #+BEGIN_EXPORT html
Note
#+END_EXPORT I had to use =--engine=jinja= because /willy-theme/ uses jinja templating. If you are using the /mako/ engine, you don't need to add thihs as the *default* is /mako/. #+BEGIN_EXPORT htmlwarning
#+END_EXPORT You will /probably/ need both themes in your =themes/= directory. The /willy-theme/ needs to be installed before creating your /custom/ theme from it. #+BEGIN_EXPORT html