##注册github帐号 在github上注册帐号, 如果你的帐号为heroin 创建heroin.github.com这个项目.

##安装jekyll 安装jekyll到github上, 这里我用的是 Jekyll-Bootstrap

执行以下命令

# git clone https://github.com/plusjade/jekyll-bootstrap.git heroin.github.com
# cd heroin.github.com
# git remote set-url origin git@github.com:heroin/heroin.github.com.git
# git push origin master

然后直接访问http://heroin.github.com, 就能访问到你搭建的博客了.

##配置jekyll

修改_config.yml文件

将一些基础信息配置成想要的内容

####配置首页 jekyllbootstrap默认的首页是index.md

但是如果需要分页效果的话需要使用的是index.html, 并且修改_config.yml, 添加一个配置项paginate: 5

详细的配置可以clone我的博客进行看https://github.com/heroin/heroin.github.com

##添加文章 在_posts目录下新建一个markdown(*.md)文件, 文件命名规范是yyyy-mm-dd-url, 例如该文章的文件为2012-05-18-github-blog-jekyll-bootstrap.md

得到的访问路径却是 /javascript/2012/05/18/github-blog-jekyll-bootstrap/
其中/javascript是在markdown文件中配置的.

markdown文件头需要几个配置, 以下是该文章的头配置

---
layout: post
title: 在github上搭建博客
category: javascript
tags: [github, bootstrap, jekyll, javascript]
---

每个markdown必须在头部加上这段. 然后下面直接写markdown代码就行了.

##配置域名 > 新建一个CNAME文件, 里面直接写上所配置的域名, 例如heroin.so

然后上域名提供商上配置域名解析, A记录到207.97.227.245

等待域名解析完毕即可, 直接访问http://heroin.github.com 会跳转至 http://heroin.so



blog comments powered by Disqus