In this post I describe how did I set up this blog. As you probably figured it out it uses the very minimalistic Pelican engine. In this post -- and generally in the upcoming ones -- I'll assume that we are on a Debian (or derivative) OS. One of the benefits of Pelican is that you can edit your blog posts in your favourite text editor locally on your computer without the need to have an internet connection.
The whole concept of Pelican is that you write some content in the form of text files, you copy them to a specific folder (which is, surprisingly called 'content'), you run a simple command which, based on the content you added, generates a folder hierarchy with a bunch of static html and style files inside ready for being published. The next diagram intends to be a sort of illustration of the above.
I won't talk about publishing here, but I will cover all other parts of this workflow.
Since Pelican is written in Python, what we need for sure is Python itself. We also install a Python package installer.
apt-get install python python-pip The official documentation suggests to set up a Python virtual environment, so I proceeded accordingly.
After this having done, you can install pelican with
pip install pelicanAt the moment I'm not convinced that this virtual environment is being used at all or how Python finds it, but it works anyways. What remains is generating a working directory and after it's done we can already start adding our content and configuring according to our taste:
It asks a few questions which I won't detail here, but they are not hard to answer. As a result, it populates the chosen directory with a few files and folders, the most important of those are:
- pelicanconf.py: this is the main configuration file.
- content: you must place your content into this folder. I'll explain later how.
- output: this folder contains your generated site, i.e. all the files and folders you wish to upload to your server later on. It is populated by Pelican based on what you have in the 'content' folder and in your configuration file.
So far I made the following changes to the autogenerated configuration file.
RELATIVE_URLS = True
The first one was needed because I wanted to have document-relative URLs, so everything works properly when I open up the generated index.html in a web browser. The second one was needed because you have to tell Pelican explicitly the location of your static files such as images, etc.
Adding content is as easy as placing HTML files into the folder called 'content'. Here is a template file for example. You create one such file for each of your posts. After that it only remains to generate your site with the command
and check the result with
There are comments.