1. Install Hexo
1 | $ sudo npm install -g hexo-cli |
2. Create a project for your GitHub Pages
1 | $ hexo init blog |
3. Run a test server for your page on Mac
1 | $ hexo server |
4. Set information for your new blog
https://hexo.io/docs/configuration.html1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17$ vi _config.yml
~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Site
title: up8.wang
subtitle:
description: yt8yt's personal blog
author: yt8yt
language:
timezone: Japan
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://up8.wang
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
5. Set information to use Git
https://github.com/hexojs/hexo-deployer-git1
2
3
4
5
6
7
8
9
10$ npm install hexo-deployer-git --save
$ vi _config.yml
~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/felix-cao/felix-cao.github.io.git
branch: master
6. Set “watch” before starting your work
“watch” command can monitor your files.
https://hexo.io/docs/generating.html1
$ hexo generate --watch
7. Create a new post file
1 | $ hexo new first-post |
8. Edit the above file with Markdown or Hexo’s Helper
Hexo’s Helper
https://hexo.io/docs/helpers.html
I use Atom with “shift + control + m” when I use Markdown :-)
https://atom.io/
9. Delete “source/_posts/hello-world.md”
It’s not necessary to deploy.
10. Deploy your new blog!!
https://hexo.io/docs/deployment.html1
2$ hexo clean
$ hexo deploy
After writting the above command, you can see your new blog on GitHub Pages.
http://******.github.io/
11. Change your blog theme
https://github.com/hexojs/hexo/wiki/Themes1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20For instance, How to use the following theme.
https://hexo.io/hexo-theme-light/
## Install it
$ cd blog
$ git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
## Update the above files
$ themes/yilia
$ git pull
## Set information to use the theme
$ cd ../
$ vi _config.yml
~~~~~~~~~~~~~~~~~~ _config.yml ~~~~~~~~~~~~~~~~~~
# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: yilia
12. Create a new page file
https://hexo.io/docs/writing.html1
2
3
4
5
6$ hexo new page aboutme
INFO Created: ~/***/felix-cao.github.io/source/aboutme/index.md
$ cd source/aboutme/
$ vi index.md
13. 部署自己的域名
接着你需要做的是在hexo根目录的source文件夹里创建CNAME文件,不带任何后缀,里面添加你的域名信息,如:up8.wang。实践证明如果此时你填写的是www.up8.wang那么以后你只能用www.up8.wang访问,而如果你填写的是up8.wang。那么用www.up8.wang和up8.wang访问都是可以的。重新清理hexo clean,并发布即可用新的域名访问。
14. Use Plugins
https://github.com/hexojs/hexo/wiki/Plugins
Reprint: btfak/useHexo.md