Skip to content

about building github page blog

kuang edited this page Jun 3, 2015 · 10 revisions

利用github的代码库做一个博客 http://p2227.github.io/

github上要处理的部分

  • 建立一个叫 p2227.github.io 的 repository
  • master分支上的代码即是主页
  • 想要独立域名,上传一个 CNAME 文件即可,内容为你的域名 如 gh.p2227.com

搭建本地环境

  1. 搭建ruby环境:推荐安装 railsinstaller 3.0 ruby + rail + git + gem + DevKit 等一应俱全
  2. 参考 这里这里 现在我的安装目录 是 D:\ProgramDev\RailsInstaller
  3. 2015-03-25 发现:这个目录不要太深,因为在搞sass的时候遇到目录太深文件不能生成的问题
  4. D:\ProgramDev\RailsInstaller\Ruby2.0.0\setup_environment.bat 运行这个脚本即可设置环境变量
  5. DevKit 目录运行 ruby dk.rb init
  6. ruby dk.rb install 之后,如果提示 Invalid configuration or no Rubies listed. Please fix 'config.yml' ...则要在 D:\ProgramDev\RailsInstaller\DevKit\config.yml 中加入 两行- D:/ProgramDev/RailsInstaller/Ruby2.0.0
  7. 设置代理方法:设置环境变量 HTTP_PROXY,推荐用fiddler set HTTP_PROXY=http://locahost:8888/
  8. 如果系统提示不能建立https连接,尝试使用http源(在hw环境,此步骤需要有代理) (PS:不知道 http://ruby.taobao.org/ 能不能访问,反正我的账号不能)
        gem sources -r https://rubygems.org/
    
        gem sources -a http://rubygems.org/
  9. gem install jekyll 此步骤会因为网络问题失败很多次,请多次重试
  10. jekyll --version 校验是否安装成功
  11. 在特定目录,jekyll new my-awesome-site
  12. 安装python,我安装的是2.7.9。并且加入path变量 否则 打开网站会一片空白 参考这里
  13. jekyll serve 然后打开 http://127.0.0.1:4000/

jekyll themes

http://jekyllthemes.org/themes/feeling-responsive/
http://jekyllthemes.org/themes/jekyll-clean/
http://jekyllthemes.org/themes/contrast/

博客系统 Octopress

  • gem install execjs
  • git clone https://github.com/imathis/octopress.git
  • cd octopress
  • gem install bundler
  • bundle config mirror.https://rubygems.org/ http://rubygems.org/
  • bundler install
  • rake install
  • ----发布系统----
  • bundle exec rake generate
  • rake deploy (注意,发布到master仅仅需要 _deploy 目录的东西,我们可以把整个源代码发布到source分支)
  • 以上_deploy目录是在_config.yml中配置的,配置项是destination

Octopress themes

http://yanping.me/cn/
http://kaworu.github.io/octostrap3/index.html
http://www.lijinma.com/
http://www.johnkeith.us/
http://blog.justin.kelly.org.au/octopress-theme/ 告诉你怎么把默认的修改成他的样子
http://syui.github.io/ tag clound
http://jser.it/ Tag Cloud
部署方法

$ cd octopress
$ git submodule add GIT_URL .themes/THEME_NAME
$ rake install['THEME_NAME']
$ rake generate