使用 Pelican + GitCafe Pages 创建 Blog

1 十一
2012
# 作者: riku / 本文采用CC BY-NC-SA 2.5协议授权,转载请注明本文链接

原文地址: http://riku.gitcafe.com/pelican-gitcafe.html

Pelican 是一个法国人用 python 写的用于生成静态页面的程序,现在我就使用 Pelican + GitCafe Page 来创建了这个 Blog

# 我的系统环境: Ubuntu 12.10

安装 Pelican

安装 python pip

sudo apt-get install python-pip

安装 Pelican

pip install pelican

创建 Blog

创建一个 Blog 目录

mkdir riku.gitcafe.com
cd riku.gitcafe.com

快速创建 Blog

pelican-quickstart

根据提示一步步输入相应的配置项

撰写文章

在 content 目录下用 Markdown 语法来写一篇文章

Date: 2010-12-03 #日期

Title: My super title #标题

Tags: thats, awesome #标签

Slug: my-super-post #URL

文章内容

生成静态页面

创建输出目录

mkdir riku

生成页面

pelican -s pelicanconf.py content -o riku

上传到 GitCafe

先到 GitCafe 上创建一个与你用户名相同的项目,比如我的。

「参考文档: 这里

进入静态页面输出目录

cd riku

初始化 git 仓库

git init

创建一个gitcafe-pages的分支,并切换到该分支

git checkout -b gitcafe-pages

添加所有文件

git add .

提交

git commit -m "init"

添加远程仓库

git remote add origin [email protected]:riku/riku.git

push 到 GitCafe 仓库

git push -u origin gitcafe-pages

完成

push 完成以后就可以在访问 GitCafe Pages 地址了。 http://riku.gitcafe.com

# 千万不要用 make html 来构建 Blog ,它会删除输出目录后重新生成 Blog ,这意味着会删除 .git 库。

为了方便下次发布,我自已创建了一个名为 publish.sh 的脚本。

$ cat publish.sh

pelican -s pelicanconf.py content -o riku

cd riku

git add .

git commit -m “Update”

git push

cd ../

我的 pelicanconf.py 配置

$ cat pelicanconf.py

#!/usr/bin/env python

# –– coding: utf-8 –– #

AUTHOR = u”Riku”

SITENAME = u”Matrix”

SITEURL = ‘http://riku.gitcafe.com’

TIMEZONE = ‘Asia/Shanghai’

DEFAULT_LANG = ‘cn’

# Blogroll

LINKS = ((‘Wow!Ubuntu’, ‘https://wowubuntu.com/’),

(‘GitCafe’, ‘https://gitcafe.com’),)

# Social widget

SOCIAL = ((‘Twitter’, ‘http://twitter.com/riku’),

)

DISQUS_SITENAME = ‘riku-gitcafe’

DEFAULT_CATEGORY = (‘Post’)

DISPLAY_PAGES_ON_MENU = True

DEFAULT_PAGINATION = 10

参考:

官方帮助文档: http://docs.getpelican.com/en/3.0/

riku

关注新网络、Web2.0、移动应用;Nexus S/Andorid,iPad,FreeBSD,Ubuntu 用户;伪设计师,好推墙运动。

More PostsWebsite

Follow Me:
TwitterFacebookGoogle PlusFlickr

  • 作者: riku
  • Post Time: 2012/11/01 4:30:15 下午
  • In: 技巧

3 Responses to 使用 Pelican + GitCafe Pages 创建 Blog

stackr

Opera 12.02 Opera 12.02 GNU/Linux GNU/Linux

十一月 1st, 2012 at 8:06 下午

绝世好文

Avatar

NIX

Mozilla Compatible Mozilla Compatible iPad iOS 6.0 iPad iOS 6.0

十一月 1st, 2012 at 8:55 下午

许久没用,居然支持pages了,支持呀!

Avatar

mellon

Firefox 15.0.1 Firefox 15.0.1 GNU/Linux GNU/Linux

十一月 25th, 2012 at 1:47 下午

Nice post!

top