pelican 主题
安装
使用 pelican 真的很方便,下面2条命令就可以了
pip install pelican
pelican-quickstart
安装后,文件结构如下:
yourproject/
├── content
│ └── (pages)
├── output
├── tasks.py
├── Makefile
├── pelicanconf.py # Main settings file
└── publishconf.py # Settings to use when ready to publish
其中,publishconf.py 包含 pelicanconf.py,publishconf.py 里面添加发布的额外配置
主题
可以在https://github.com/getpelican/pelican-themes 下载主题
下载到 project 目录,pelicanconf.py 添加 THEME = "pelican-themes/nikhil-theme"
。
试了几个主题,比较喜欢 nikhil 的风格, 但是也有些问题,一是主页上的文章时间格式不是很喜欢,二是页面加载时候很长,甚至会有一些css等下载失败。
由于 pelican 是 python 写的,而且使用 jinja 渲染的,对这些比较熟悉,所以就自己修改了。
-
时间修改 修改
pelican-themes/nikhil-theme/templates/index.html
, 时间改为:article.date|strftime('%Y-%m-%d')
-
css, js 改为放在本地 nikhil 使用了 bootstrap,把 bootstrap.min.js, bootstrap.min.css 等下载下来,放到 nikhil-theme/static 目录下。