1. What is Pelican?

Pelican Logo

Pelican is Static site generator powered by Python
“Pelican” is an anagram of calepin, which means “notebook” in French.

you can see more information at Pelican Offical Site.


2. Pelican Quick Start

2.1 Install Dependencies

💡 Prerequisites

Pelican should be presupposed cause it is python based. confirm below commands

  • python
  • pip
# core library
pip install pelican

# additional library: markdown
# add markdown package for using markdown editor
pip install markdown

# additional library: typogrify
# add typogrify for typographically-improved HTML
pip install typogrify


2.2 Create Project

write below commands sequentially

# make folder for project
mkdir pelican-demo

# move to folder
cd pelican-demo

# initialize folder for Pelican project
pelican-quickstart


you can configure options while running command

Welcome to pelican-quickstart v4.9.1.

This script will help you create a new Pelican-based website.

Please answer the following questions so this script can generate the files
needed by Pelican.

> Where do you want to create your new web site? [.]
> What will be the title of this web site? Pelican Demo
> Who will be the author of this web site? Heejeong Kim
> What will be the default language of this web site? [Korean]
> Do you want to specify a URL prefix? e.g., https://example.com   (Y/n) n
> Do you want to enable article pagination? (Y/n) y
> How many articles per page do you want? [10]
> What is your time zone? [Europe/Rome]
> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) y
> Do you want to upload your website using FTP? (y/N) n
> Do you want to upload your website using SSH? (y/N) n
> Do you want to upload your website using Dropbox? (y/N) n
> Do you want to upload your website using S3? (y/N) n
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n
> Do you want to upload your website using GitHub Pages? (y/N) y
> Is this your personal page (username.github.io)? (y/N) n


2.3 Structure

The project has below structure if you make project via pelican-quickstart.

yourproject/
├── content         # posting directory
│   └── (pages)
├── output          # build directory
├── tasks.py            # setting and running code
├── Makefile            # build file
├── pelicanconf.py      # Main Setting file
└── publishconf.py      # Settings to use when ready to publish

you make a new .md file in content directory if you want to write a new post


2.4 Command

build ⚡

you can run project after build

# default command
pelican

# command with [path]
pelican content

# command with [path] [-o output_directory] [-s setting_file] [-t template_directory]
pelican content -o output -s publishconf.py -t themes/twinkle


run 🔥

pelican --listen


etc

if you want to see more, type pelican --help

pelican --help
usage: pelican [-h] [-t THEME] [-o OUTPUT] [-s SETTINGS] [-d] [-v] [-q] [-D] [--version] [-r]
               [--print-settings [SETTING_NAME ...]] [--relative-urls] [--cache-path CACHE_PATH] [--ignore-cache]
               [--fatal errors|warnings] [--logs-dedup-min-level {DEBUG,INFO,WARNING,ERROR}] [-l] [-p PORT] [-b BIND]
               [-e [OVERRIDES ...]]
               [path]

A tool to generate a static blog, with restructured text input files.

positional arguments:
  path                  Path where to find the content files. (default: None)

options:
  -h, --help            show this help message and exit
  -t THEME, --theme-path THEME
                        Path where to find the theme templates. If not specified, it will use the default one included
                        with pelican. (default: None)
  -o OUTPUT, --output OUTPUT
                        Where to output the generated files. If not specified, a directory will be created, named
                        "output" in the current path. (default: None)
  -s SETTINGS, --settings SETTINGS
                        The settings of the application, this is automatically set to pelicanconf.py if a file exists
                        with this name. (default: None)
  -d, --delete-output-directory
                        Delete the output directory. (default: None)
  -v, --verbose         Show all messages. (default: None)
  -q, --quiet           Show only critical errors. (default: None)
  -D, --debug           Show all messages, including debug messages. (default: None)
  --version             Print the pelican version and exit.
  -r, --autoreload      Relaunch pelican each time a modification occurs on the content files. (default: False)
  --print-settings [SETTING_NAME ...]
                        Print current configuration settings and exit. Append one or more setting name arguments to
                        see the values for specific settings only. (default: None)
  --relative-urls       Use relative urls in output, useful for site development (default: False)
  --cache-path CACHE_PATH
                        Directory in which to store cache files. If not specified, defaults to "cache". (default:
                        None)
  --ignore-cache        Ignore content cache from previous runs by not loading cache files. (default: False)
  --fatal errors|warnings
                        Exit the program with non-zero status if any errors/warnings encountered. (default: )
  --logs-dedup-min-level {DEBUG,INFO,WARNING,ERROR}
                        Only enable log de-duplication for levels equal to or above the specified value (default:
                        WARNING)
  -l, --listen          Serve content files via HTTP and port 8000. (default: False)
  -p PORT, --port PORT  Port to serve HTTP files at. (default: 8000) (default: None)
  -b BIND, --bind BIND  IP to bind to when serving files via HTTP (default: 127.0.0.1) (default: None)
  -e [OVERRIDES ...], --extra-settings [OVERRIDES ...]
                        Specify one or more SETTING=VALUE pairs to override settings. VALUE must be in JSON notation:
                        specify string values as SETTING='"some string"'; booleans as SETTING=true or SETTING=false;
                        None as SETTING=null. (default: {})