Pelican is a static website generator written in pure python. It is an opensource project and it is being used to create personal website to project webpages. So as you think a blog is dynamic with new content, how do a static generator fit for the job ?
Static generator is generating html pages every time you generate site with content, so your site can be dynamic for some extent.
Create pelican blog locally
First you need to configure Pelican blog locally, then you can publish them to webserver/GitHub Page.
- Pelican package
- Editor, Visual Studio Code/sublimText recommended.
You can install pelican with markdown support from Pypi repository.
python -m pip install "pelican[markdown]"
Create blog project
Let’s get started Create a folder for your project and step into it using CD, go it console and let pelican create a Skelton structure of your site by asking a series of questions.
mkdir -p ~/projects/yoursite cd ~/projects/yoursite pelican-quickstart
In your project folder you can see a site folder and inside it reach config.py which is the settings for your pelican site. Change if you need anything.
Posts and Pages
Under the content folder your can create post as markdown file and for pages create folder Pages and create About page using markdown. Your markdown can be composed with following format
Title: My First Review Date: 2010-12-03 10:20 Category: Review Following is a review of my favorite mechanical keyboard.
Generating content and view your site
Create few posts and pages and hit pelican content on the terminal will generate the html files for your site. Using pelican –listen command will make your site live with localhost:8000. To terminate press Ctrl+C
Hosting the site to Github Page
First up all create a repository , name should match <username.github.io> / <organization>.github.io and add the repo to your site folder. The master branch will be used to publish your page. Check your repository for page setting.
Well for updating content, you need to regenerate the content and Add,commit and push it back to the GitHub Repository and it will go live in seconds. See a demo
Find a way to extent the visual appearance and functions of your blog by using Themes and Plugins. Visit the GitHub Repo of Pelican Project
For detailed documentation visit Official Quicks tart Guide