My original blog has been written with Octopress and then I migrated to Hexo. This post guides one to build up a blog with Hexo.
Prerequisite
Install
1 | npm install hexo-cli -g |
Usage
Create Hexo blog
1
2
3hexo init <folder>
cd <folder>
npm installCreate a new page or post
1
2hexo new "<post>"
hexo new page "<page>"Build up the blog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17# Generate static files
# hexo g
hexo generate
# Run the blog at http://localhost:4000
# hexo s
hexo server
# Deploy blog on website (e.g. GitHub)
# hexo d
hexo deploy
# Generate static files and run server
hexo s -g
# Generate static files and deploy
hexo d -gChange the theme (e.g. NexT)
1
2
3
4
5git clone https://github.com/theme-next/hexo-theme-next.git themes/next
# Modify _config.yaml
cat _config.yaml
# theme: nextDeploy to GitHub page
1
2
3
4
5
6
7
8
9
10
11
12# Install plugin
npm install hexo-deployer-git --save
# Modify _config.yaml
cat _config.yaml
# deploy:
# type: git
# repo:
# github: git@github.com:<username>/<username>.github.io.git
# Deploy
hexo d