Pelican From The Ground Up

Static Site generator is a tools that generate static html file and folder structure. It takes content from one format and put it into a template to make a complete html page. This type of website is suitable for most website like small blog, personal website, company website. More complexity can be added to turn it into a JAM (Javascript, API, markup) stack, which means the contents or data can be from a text file, markdown, database or even from an API endpoints.

Pelican is a python static site generator. (This is the same as Ruby Jekyll, Go Hugo, React Gatsby and other static site generator). A static site can be hosted on any kind of server, thougn it is not recommended to setup your own server or cloud if you have zero or little idea what to do with a cloud server as it more exposed to risk as it is always conencted to the internet. Id you are a front end or a beginner or just lazy to setup your own server (because it is another load of work or running script and reading logs), you can use github pages, Netlify, or any other popuplar hosting services. However free github account will require to make your site repo public in order to publish a github pages (which is weird as it exposed to risk of domain name stealing if you wish to use custom domain).

  • Python Static Site Generator - Pelican

    • comparison
    • pros and cons
    • conclusion
  • Getting Started With Pelican - Part 1

    • installing pelican, python venv & project folder
    • Configure your pelican
      • vs publish.conf
    • Writing post in Markdown
    • Viewing local output
    • Publish the site
    • publish to github pages
  • Pelican Customizing your theme - Part 2

    • theme folder structure
    • Writing theme in jinja2
    • publish your site with your custom theme
    • Theming with Pelican Plugins
      • sitemap
      • readtime
      • pelican-toc
    • pelican-open_graph
    • Page with Custom Template
    • Syntax Highlighting with highlight.js
    • Google Analytics
  • Pelican Github Pages - Part 3

    • publish to github pages
    • Using Custom Domain
      • update A record
    • Automate with Git Hooks
  • Pelican Netlify - Bonus

The reason i'm using pelican is because i'm fluent in python more than hugo or react. I work as a python programmer for more than a year and i've been using it for 9 years personally. If you are interested to know my programming language preferences and stack, feel free to visit the about page. I put a quite detail of my stack there.

Getting Started With Pelican


installing pelican, python venv & project folder


Generate Site Output

$ pelican /path/to/your/content/ [-s path/to/your/]
$ source venv/bin/activate
$ pelican content -t themes/noxasch_re
$ pelican content --autoreload --listen -t themes/noxasch_re

Developing with live Output

Pelican can also watch file modification instead of manually rerunning pelican generate command. The site is auto-generated and serve at http://localhost:8000

$ pelican --autoreload --help

Publish to Github pages

$ ghp-import output -b gh-pages
$ ghp-import output -b dist -m "update url with www"
$ ghp-import output -b gh-pages -m "message"
$ git push origin gh-pages
$ git push origin dist