Implement my Hexo

Intro

This may be big progress in my learning road,lol.

All in all, I implemented my first blog based on GitPage + Hexo. After several days struggles, I finally accomplished the basic framework of it. So I try to record how I did this ^.^.

This article would consists of three part:

  1. Install Hexo
  2. Hexo Instruction

Install Hexo

Hexo environment configeration

Just before installing Hexo, we need to install some dependencies. I use Homebrew to install them, so I recommend Mac’s users to use homebrew. Very helpful~

Please have Homebrew installed first.

Git

Open your terminal and type:

1
$ brew install git

Use Homebrew to install, Git would be installed in /usr/local/Cellar/git/.

Node.js

1
$ brew install node

Use Homebrew to install, Git would be installed in /usr/local/Cellar/node/.

Hexo

Open your terminal and type:

1
$ npm install hexo -g

Wow, finished!

If we want to update our hexo, simply type:

1
$ npm update hexo -g

Then, we initiate a folder to save files of your site:

1
$ hexo init <folder>

Wait a second, we will see

1
$ INFO Start blogging with Hexo!

Yeah, we finished!


Hexo Instruction

Create a new post

1
$ hexo new "POST NAME"

Run server

1
$ hexo server

or

1
$ hexo s

then we can debug our site in localhost.

Generate static files

After we new a post, we will have .md file under /yourBlogFolder/source/_post folder. Use this instruction to generate static files(html) for this .md

1
$ hexo generate

or

1
$ hexo g

Deploy

Once you think your modification finished, just deploy it to your git.

1
$ hexo deploy

or

1
$ hexo d