码迷,mamicode.com
首页 > 系统相关 > 详细

Linux-github 搭建静态博客

时间:2015-07-17 19:03:58      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:克隆   new   github上   bootstrap   安装   

1.在Github上创建一个新的Repository

到你的github上 https://github.com去create a new repository命名为 github.myblog
技术分享

2.本地安装Jekyll-Bootstrap

如果本地centos没有git,使用yum安装

$ yum install git

克隆jekyll-bootstrap

$ git clone https://github.com/plusjade/jekyll-bootstrap.git myblog
$ cd myblog
$ git remote add origin-myblog https://github.com/csuldw/myblog.git
$ git push origin-myblog master        #代码传至github

技术分享

经过上面的代码之后,就可以看到自己的博客了:http://myblog.github.io/

github文件目录

技术分享

3.安装Jekyll

使用下面代码看看是否安装了jekyll

$ git clone https://github.com/plusjade/jekyll-bootstrap.git
$ cd jekyll-bootstrap
$ jekyll serve

根据网址http://localhost:4000. 看是否安装成功

如果没有安装成功,下面再centos中安装jekyll,参考:https://hack0nair.me/2013-10-31-config-jekyll-on-centos/

首先安装ruby:

$ sudo yum install ruby

技术分享
接着安装jekyll

$ gem install jekyll

然后回到myblog目录,执行下列代码检测jekyll是否安装成功

$ jekyll server

如果出现下面情况,表示安装成功
技术分享

4.创建一个页面

下载rake

$ gem install rake

创建页面

$ rake page name="about.md"

创建一个内部页面

rake page name="pages/about.md"

技术分享
Create a page with a “pretty” path:

$ rake page name="pages/about"
# this will create the file: ./pages/about/index.html

The rake task automatically creates a page file with properly formatted filename and YAML Front Matter as well as includes the Jekyll Bootstrap “setup” file.

5.发布至github

$ git add .
$ git commit -m "Add new content"
$ git push origin master

技术分享

附:jekyll支持主题定做 http://jekyllbootstrap.com/usage/jekyll-theming.html

主题目录位于:_includes/themes 下面.

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux-github 搭建静态博客

标签:克隆   new   github上   bootstrap   安装   

原文地址:http://blog.csdn.net/dream_angel_z/article/details/46928761

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!