zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Linux-github 搭建静态博客

2023-09-11 14:20:59 时间

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