Pelican - How to add an article

mar. 15 janvier 2019 by Martin Deudon

pelicanlogo

Pelican is a static site generator, written in Python. This site is based on Pelican.

Documentation : http://docs.getpelican.com/en/stable/

There are a great number of tutorial on the internet explaining how to start a Pelican site. In this article we will simply see how to add an article.

Articles are written using the Markdown syntax (.md files). Each article belongs to a category and are stored in the content directory, in a folder named after the category.

To add an article create a new file in folder correponding to the article category.

For now, 5 categories are defined: eeg, misc, projects, python and software; but a new one can be added at anytime.

The header of the markdown file should look like this :

Title: Pelican - How to add an article to this site
Date: 2019-01-15 11:19
Category: python
Tags: Pelican, Doc

In addition, you can add a cover image with the Cover keyword :

Cover: /images/banners/matplotlib_tips.png

The table of content, shown automatically at the top of the article can be hidden by adding :

toc_run: False

Update the content

Once a new article has been added, you need to generate the html files, open a terminal, go in the root directory of this project (where the Makefile file is placed) and run :

make html

You can preview you site locally by starting a local server with

make serve

And see your site at http://localhost:8000/

To publish the site to github pages use :

make github

Search content

When adding a new article, its content will not be indexed for the search tool. See how to update the content of Tipue Search.