python3 pelican 搭建靜態博客 原

安裝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

瀏覽器訪問http://localhost:8000/

參考

Create a github hosted Pelican blog with a Bootstrap3 theme

使用 pelican 和 Github pages 來搭建博客

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章