pelican 的使用
安装pelican
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple markdown
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv
此时在Cent OS提示bash: virtualenv: 未找到命令... ,解决如下:
sudo ln -s /usr/local/bin/python3/bin/virtualenv /usr/bin/virtualenv
采用virtualenv配置命令如下:
virtualenv --no-setuptools --no-pip --no-wheel --no-site-packages env01
可以用source
进入该环境安装pelican:
source env01/bin/activate
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple markdown pelican --user
可以用deactivate
命令退出这个虚拟环境
pelican的配置
mkdir 博客所在的目录
cd 博客所在的目录
pelican-quickstart
看到Do you want to specify URL prefix?
填写Y,然后填写https://username.github.io
Do you want to upload using xxx?
Answer N untill the xxx = GitHub Pages
在博客所在的目录建立.gitignore文件,内容如下:
*~
._*
*.lock
*.DS_Store
*.swp
*.out
*.py[cod]
output
- 在博客所在的根目录执行生成生成静态文件命令:
pelican content
- 发布到github.com:
You can configure GitHub Pages to publish your site's source files from master, gh-pages, or a /docs folder on your master branch for Project Pages and other Pages sites that meet certain criteria.
cd output/
git init
git add .
git remote add origin https://github.com/github用户具体名称/github用户具体名称.github.io.git
git pull origin master
git commit -m 'first blog'
git push origin master
在pelican当中,以下标记作为关键字
- Title
- Tags
- Date
- Modified
- Status
- Category
- Author
- Authors
- Slug
- Summary
- Template
- Save_as
- Url
使用已完成html作为文章发布的方法如下:
<html>
<head>
<title>My super title</title>
<meta name="tags" content="thats, awesome" />
<meta name="date" content="2012-07-09 22:28" />
<meta name="modified" content="2012-07-10 20:14" />
<meta name="category" content="yeah" />
<meta name="authors" content="Alexis Métaireau, Conan Doyle" />
<meta name="summary" content="Short version for index and feeds" />
</head>
<body>
This is the content of my super blog post.
</body>
</html>