A succint guide to Pelican
Pelican is the most well-known static site generator written in Python, whose first working version is from august of 2010. The current stable version in april 2020 is version 4.2. This is my concise guide to Pelican.
$ mkproject blog # Create a new virtual environment (I use virtualenvwrapper)
(blog) $ pip install pelican # Install pelican inside the virtualenvironment
(blog) $ pelican-quickstart # Run pelican-quickstart so filling a default configuration
It's probable that we would like to install an alternative theme. For this just create a new folder themes in the blog root folder, and clone the themes inside the themes folder from their github repository.
For example, if I want to use this theme: https://github.com/gunchu/nikhil-theme, I would do:
(blog) $ mkdir themes; cd themes
(blog) $ git clone https://github.com/gunchu/nikhil-theme
In case we would like to download only one of the pelican-themes, we can do it downlading with subversion (svn) a modifying url of the specific theme. We have to change the tree/master part to trunk. For example:
Original url of the pelican-theme:
Subversion download of the modified theme:
svn checkout https://github.com/getpelican/pelican-themes/trunk/cebong
Now just edit pelicanconf.py in the root folder, and add the complete root of the theme: THEME = '/home/carlos/blog/themes/nikhil-theme'
That's it. So simple. Just download the theme and point this theme from the pelicanconf.py file.
pelican content # Generates the content
We can view it locally with:
pelican --listen -p 8002 -r # Optionally we can indicate the port if we want one different to the default 8000, and we want it to detect changes and reload the server (-r)
We can upload it to a server using: $ make rsync_upload