Github + Hexo + yilia quickly build blog

Article Directory

GitHub is a project for open source and proprietary software hosting platform, is a distributed version control system, as detailed Baidu Encyclopedia.
Github Pages is a feature on github, you can place the page file to a specified folder, and then give you a unique domain name for show some projects, but now mostly used to develop the production of personal blog sites.
Then step by step in accordance with the steps I used to build personal blog.

ready

Git client installation, operation and related Git, this part of your own Baidu.
nodeJs, mainly as a local server can preview the effect.
Hexo, it is a fast, simple and efficient framework blog. There is also a Jekyll, said the Internet fast Hexo speed, all tried it, feel beautiful and Hexo relatively simple point.
yilia, a template interface only, you can choose like, here is https://github.com/voidking/hexo-theme-yilia.git .

Github configuration

Git client configuration, Github account application, SSH Key Configuration.
Creating a warehouse, named username.github.io (username is your account name)

Creating a warehouse

The establishment of two branch, master for web publishing, in addition to a blog for Hexo page file, manually managing and editing a blog branch, set GitHub Pages for master branch in setting the repo's.

Hexo environment configuration

Installation nodejs
will be created above the repo clone to a local, open Git Bash.

1
2
3
4
5
6
7
8
9
10
11
12

Npm install HEXO-cli $ -g
# View version to confirm whether the installation was successful
$ HEXO -version
# station
$ HEXO the init
# turn input git --version, node -v, npm -v , hexo version, in order to detect and Git node npm hexo version
$ git --version, -v the Node, npm -v, hexo version
# generate static pages (markdown files into html files)
$ hexo the generate
# site preview (the default theme style landscape, http: // localhost: 4000 /)
$ HEXO Server

Hexo common commands

Common commands

1
2
3
4
5
6
7
hexo new "postName" #新建文章
hexo new page "pageName" #新建页面
hexo generate #生成静态页面至public目录
hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server)
hexo deploy #部署到GitHub
hexo help # 查看帮助
hexo version #查看Hexo的版本

缩写

1
2
3
4
hexo n  大专栏  Github+Hexo+yilia快速搭建博客== hexo new
hexo g == hexo generate
hexo s == hexo server
hexo d == hexo deploy

组合

1
2
hexo s -g #生成并本地预览
hexo d -g #生成并上传

yilia模板

模板下载,hexo的模板有很多,可以自己选择一款

1
2
#进入themes目录,下载yilia主题
git clone https://github.com/voidking/hexo-theme-yilia.git yilia

配置文件修改, 主题的优化参考 https://www.voidking.com/2015/05/31/deve-hexo-theme-optimize/

1
2
#进入usename.github.io下面的_config.yml修改,主要是下面这一条
theme: yilia

现在可以在本都预览到yilia样式的博客了。

发布到github

首先是将该项目同步到github的blog分支,普通的git操作。

1
2
3
4
git pull origin blog
git add .
git commit -am " "
git push origin blog

然后是将博客生成静态页面deploy到github的master分支。
再次之前,首先配置_config.yml中有关deploy的部分,修改为如下所示。

1
2
3
4
5
6
Deploy: of the type : git # corresponds warehouse SSH address (can be copied in the corresponding GitHub repository)   repo: [email protected]: usename / usename.github.io.git # (branch: User Pages as master, Project Pages for the blog branches)   branch: Master





After configuration, save, and then right-click your project folder open git bash, enter npm install hexo-deployer-git -save install the relevant plug-ins.
Posted HTML code is generated to the master branch with hexo deploy command.

1
2
3
4
Generate HEXO 
HEXO Deploy
#, or by a combination of instructions
hexo d -g

Daily blog written in the source below _posts folder, written in markdown format, the preview is no problem and then uploaded on the project uploaded to the blog branch, static pages in the master branch.

references

hexo theme optimization

GitHub + Hexo build a blog

github + hexo set up their own blog site

Guess you like

Origin www.cnblogs.com/sanxiandoupi/p/11710876.html