This article will tell you how to quick setup with hexo.

1.Initialize

1
2
3
$ hexo init <folder>
$ cd <folder>
$ npm install

Once initialized, here’s what your project folder will look like:
.
├── _config.yml
├── package.json
├── scaffolds
├── source
| ├── _drafts
| └── _posts
└── themes

2.Create a post

1
$ hexo new "My New Post"

The will create a post named “My New Post”, and the post will be saved as /source/_posts/My-New-Post.md.

3.Update/Delete a post

If you want to update or delete a post ,you just need to operation the “.md” file of the post.

4.Generates static files

1
$ hexo generate

Or

1
$ hexo g

5.Run a local server

Before it starts a local server ,it is necessary to generates static files.

1
$ hexo server

Or

1
$ hexo s

It will start a local server. By default, this is at http://localhost:4000/.

6.Deploy to remote sites

6.1 Create a GitHub repository

Create a new repository named username.github.io, where username is your username (or organization name) on GitHub ,such as jianrry/jianrry.github.io.

6.2 Install hexo-deployer-git

1
$ npm install hexo-deployer-git --save

6.3 Edit _config.yml (with example values shown below as comments)

1
2
3
4
5
deploy:
type: git
repo: <repository url>
branch: [branch]
message: [message]

6.4 Deploy to GitHub

Before it deploys to remote sites ,it is necessary to generates static files.

1
$ hexo deploy

Or

1
$ hexo d

You can use the command $ hexo d -g to deploy to remote sites ,it will automatically generates static files before deployment.

7.Reference

Documentation | Hexo