Linux-github 搭建静态博客 - Go语言中文社区

Linux-github 搭建静态博客


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 下面.

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/Dream_angel_Z/article/details/46928761
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-04-18 17:35:51
  • 阅读 ( 1450 )
  • 分类:Linux

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢