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 来搭建博客

转载于:https://my.oschina.net/yimingkeji/blog/2876061

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值