What is Pelican?
Pelican is a Static Site Generator powered by Python. Pelican is written in Python and it doesn't need any database or server side programming. Simply we can write the content of the webpage and run pelican server to view the page containing the content. It is simmple and easy to use to publish your content.
Pelican is written in Python and hence the python need to be installed in your machine. Most of the GNU/Linux distros will have python.
To check the availability of python in your machine, open terminal and type the following command
If python was not installed, Click Here!.
After installing python and necessary packages, install pelican using the following command
sudo pip install pelican
And thus pelican will be installed in your machine.
Getting Started with Pelican
Once you installed pelican in your machine, get started using the following.
Make a new directory with the site name by the command mkdir folder-name and enter into that directory by the command cd folder-name.
After entering into that directory type the following command
Then terminal will prompt with few meaningful questions in simple english. You could answer to that questions once you read it. After answering all the questions, your outline of the website will be created.
Then type ls command to see the files generated by the pelican.
Now you are containing the fresh site outline without any content.
To see the site, just follow the command.
sudo pelican content
This will make the content (if any) in the webpage.
run the pelican server using the command,
python -m pelican.server
Your page will be server in localhost:8000
Writing the article or content
The article or a content may be written in reStructuredText text files or in markdown files.
Let me go with markdown file. These are the text files with the extension, .md
Before start writing your article or content, you may need to install markdown.
To install markdown,
pip install Markdown
After installing Markdown, install typogrify
pip install typogrify
Once all finished, start writing your first awesome article.
- You can shift to the content directory using cd content
- Open a new file with filename article_name.md
- The structure of the file should be
Title: (Title of your article) Date: (Date) Category: (any catogory such as post) Your writings
If you want to learn Markdown, Click Here
Generate your site
Once you add your article in content directory, get back to the site directory by using cd .. and follow the command
sudo pelican content
This will make your site with the articles in the content folder. After that run the pelcian server by the following
- cd output/
- python -m pelican.server
Thus your site will be generated and served in localhost:8000
Installing themes in Pelican
Feeling bored with default theme. Have a attractive themes as you like.
Click Here to get themes.
Once you downloaded the zip file of the themes, just extract it somewhere.
To install the themes in pelican
pelican-themes -i (path where the themes is extracted)
pelican-themes -i /Documents/themes/clean-blog
Once the theme is installed, You can apply the theme into your site or blog by the following.
- Open the pelicanconf.py file
THEME = "theme name"anywhere in that file
- Save and close the file.
Thus the theme is applied in your blog.
To see, Just pelican content, run the server and open localhost:8000
Note: You can edit the theme by editing the html files in the theme folder.