Using Pelican Themes

Posted on September 30, 2017 in DevOps
Updated: September 30, 2017

This blog is part of a serie

  1. Using Pelican blog on Github pages
  2. Using Pelican Themes (this blog)
  3. Setting Pelican blogs in "draft"

Installation - Plugins and Themes

Plugins and Themes are two seperate repos being used by some themes. To be able to reach them from is best to clone them to place with an absolute path.

Since preference will differ I will put part of the path in system-wide environment variables

  • SystemPropertiesAdvanced.exe
    • Environment Variables – System vars – New
    • Name: PYTHON_HOME, Value: C:\ProgramFilesExtra\Python\Python36-32(Use the path to Python installed in top of previous blog)
    • Press OK until all dialogs are closed, so you are sure the variable is stored
  • Start new cmd promt (this will load the new environment variable)
  • Create a folder for the cloned repos:
md pelican-addon-clones
cd pelican-addon-clones
# Download plugins and themes
git clone --recursive
git clone --recursive

The above repo pelican-themes in some cases is not linked to the latest version of a theme. So for those themes you can clone them into another folder called pelican-themes-extra.

cd %PYTHON_HOME%\pelican-addon-clones
md pelican-themes-extra

Testing Themes

View installed themes and themes you can install

# Which themes are ready to use by Pelican? - By default Pelican is running theme "notmyidea"
> pelican-themes -v -l
# Which themes are downloaded and ready to install?
> start %PYTHON_HOME%\pelican-addon-clones\pelican-themes\

Command start opens an explorer, so you can go into the folders and see if there are any images showing how the theme looks like. Or you can checkout

I am at time of writing running with theme Flex.

Ref: Command pelican-themes

Switch to Theme "Flex"


Online Instruction

Flex is one of the themes that is not latest in pelican-themes repo, so I want to download latest from its own repo.

cd %PYTHON_HOME%\pelican-addon-clones\pelican-themes-extra
# Download Flex
git clone
# Install Flex into Pelican
pelican-themes --install C:\ProgramFilesExtra\Python\Python36-32\pelican-addon-clones\pelican-themes-extra\Flex --verbose
# pelican-themes --remove Flex
THEME = 'Flex'
STATIC_PATHS = ['img', 'static']
FAVICON = 'img/favicon.ico'
CUSTOM_CSS = 'static/custom.css'
  • Notice: If you don't want to add extra CSS, then THEME is all you have to set
  • In the CUSTOM_CSS I am just adding a shadow to images
  • In \content\static\ create a file called custom.css with the content:
img {
    box-shadow: 5px 5px 12px grey;



  • Nice looking
  • Images are shown in its full width - and resized to screen width
  • Syntax highligting is good


  • Modified/Updated date is not shown

Switch to Theme "HTML5 Up striped"


Online Instruction

# Install striped-html5up into Pelican
pelican-themes --install C:\ProgramFilesExtra\Python\Python36-32\pelican-addon-clones\pelican-themes\pelican-striped-html5up --verbose
#pelican-themes --remove pelican-striped-html5up

Plugin neighbors is needed by the theme

  • Add to
PLUGIN_PATHS = ['C:\ProgramFilesExtra\Python\Python36-32\pelican-addon-clones\pelican-plugins']
PLUGINS = ['neighbors']
THEME = 'pelican-striped-html5up'



  • Nice looking
  • Images are shown in its full width


  • It does not have any syntax coding and block around code
  • It is missing links to categories and tags links
  • Links in the left black sidemenu are not hooked to content from publishconf or other

Extending Themes

I extended theme "Flex" so it shows Modified date.

The workflow for updating a theme can be:

  1. Edit the theme in its local repo
  2. Remove the theme from Pelican
  3. Re-intall the theme to Pelican
  4. Build your output and see the change

1. Edit Theme

  • Goto the root of your theme folder and open the theme in your favorite editor. In this case I edit Flex in VS Code
cd %PYHON_HOME%\pelican-addon-clones\pelican-themes-extra\Flex
# start VS Code
code .
      <!-- Inside p-tag contining when=article.locale_date -->
      {% if article.modified %}
        Updated: {{ article.modified |strftime(DEFAULT_DATE_FORMAT) }}
      {% endif %}
  • Before you re-install the theme you should also goto your Pelican project and make sure you have DEFAULT_DATE_FORMAT set to the same format as locale_date. In you could do it like this

2. Remove Theme from Pelican

# Easiest way to remove a theme from Pelican is to delete the folder where it is installed into
start %PYTHON_HOME%\lib\site-packages\pelican\themes

3. Install Theme to Pelican

See "Switch to Theme" above.

4. Build and see output

See "Day to day Workflow" in previous blog.


The End