0%

HEXO Setup

Hexo is a fast, simple & powerful blog framework. It is based on Node.js which brings you incredible generation speed. Also, Hexo can support Markdown features and kinds of plugins.

Outline

  • Install Node.js
  • Install Hexo
  • Setup the blog
    • Initialize blog
    • Generate static files
    • Start local server to preview
    • Set theme to NexT
  • Config GitHub Pages
  • Connect Hexo to GitHub
  • Deploy Hexo into GitHub

Install Node.js

Firstly, download Node.js from https://nodejs.org/ and install it into your OS.

To check the status of installation, open the terminal:

1
$ node -v

The verion of Node.js is v8.9.4.

1
$ npm -v

The verion of Npm is 5.6.0.

Install Hexo

Open the terminal of your OS.

1
$ npm install hexo-cli -g

Setup a blog

Generate Blog related files with Hexo.

Initialize blog

Initialize a blog will create a folder named “blog” and related files.

1
$ hexo init blog

Generate static files

Change directory into “blog” and generate static files for our blog.

1
$ hexo g

Start local server

Start a local server for preview then type “localhost:4000” in your browser.

1
$ hexo s

Change themes to NexT

In the Git bash command window, get a new themes from github.

1
$ git clone https://github.com/iissnan/hexo-theme-next themes/next

Connect Hexo to Github

Add the following configuration into _config.yml file which locates in the root path of blog.

1
2
3
4
$ deploy:
$ type: git
$ repo: git@github.com:shensongjian/shensongjian.github.io.git
$ branch: master

Set “theme” option with “next”

1
$ theme: next

Deploy to remote sites

Open a terminal and install deploy tool.

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

After config hexo, the blog can be deploy to remove GitHub pages server.

1
2
3
$ hexo clean
$ hexo g
$ hexo d

Done

Now the blog with hexo can be accessed through https://shensongjian.github.io