安装pelican
$ pip3 install pelican markdown ghp-import
...
$ pelican --version
4.0.0
快速开始一个博客项目
$ pelican-quickstart
Welcome to pelican-quickstart v4.0.0.
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? my blog
> Who will be the author of this web site? atyang
> What will be the default language of this web site? [zh]
> 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/Paris] Asia/Shanghai
> 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) y
Done. Your new project is available at /Users/xxx/projs/python/pelican/helloworld
$ ls
Makefile output publishconf.py
content pelicanconf.py tasks.py
时间区域,参考https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
查看生成的文件
$ tree
.
├── Makefile
├── content
├── output
├── pelicanconf.py
├── publishconf.py
└── tasks.py
2 directories, 4 files
添加markdown文件,并生成html
到content目录下,添加first.md文件,并加入内容:
$ cd content
$ vim first.md
Title: My first post
Date: 2014-12-23 17:49
Modified: 2014-12-23 17:49
Category: misc
Tags: first, misc
Slug: My-first-post
Authors: Adrien Leger
Summary: Short version of my first blog post
This is my **first blog post with pelican**
保存后,生成html文件
$ make html
启动服务
$ make serve
参考
Create a github hosted Pelican blog with a Bootstrap3 theme
使用 pelican 和 Github pages 来搭建博客