Hexo Blog Framework
Hexo Blog Framework
Install nodejs npm And cnpm
Use the following command to install nodejs.
1 | sudo pacman -S nodejs npm |
Use the following command to show the version of nodejs.
1 | node -v |
Use the following command to show the version of npm.
1 | npm -v |
Use the following command to install cnpm by npm. (If your region is CHINA)
Root account is recommended.
1 | sudo npm install -g cnpm --registry=https://registry.npm.taobao.org |
Use the following command to show the version of cnpm.
1 | cnpm -v |
Install hexo-cli
Install hexo-cli by cnpm command.
1 | cnpm install -g hexo-cli |
Enter Your Blog Directory
Create a folder and your will write your blog in the folder.
For example: mkdir Blog
Now, we must initialize the blog folder, you can use the following command.
MUST USE ROOT ACCOUNT !
1 | sudo hexo init |
After run the command, we will get some folder and file (include hide file) automatic generation.
Such as:
1 | _config.yml |
Start Up Local Blog
Use the following command to start up local blog, and you can access ‘localhost:4000’ to view the website by brower.
1 | hexo s |
In this command, ‘s’ represents ‘server’. (Start the server)
Create A New Blog Website
Firstly, you should change your path to the blog folder.
For example:/home/occs/Blog
Secondly, use the following command to create a new markdown file.
1 | hexo n mdfilename |
In this command, ‘n’ represents ‘new’. (Create a new post)
This markdown file can be found in source under your blog folder.
Clean Up The Blog Project
Use hexo clean to clean up the blog.
Generate Your Blog
Use the following command to generate blog website.
1 | hexo g |
In this command, ‘g’ represents ‘generate’. (Genrate static file)
Deploy To Your Github Pages
Before this step, you must have a github account.
This step details will not be repeated here.
I think mostly people can sign up a github account.
If you can’t do that, I recommend to give up.(Are you kidding me?)
Let’s go.
Create Repository
Create a new repository named YOUR_GITHUB_NAME.github.io
NOTICE: Please verify your account name is same to YOUR_GITHUB_NAME.
Then you will get new repository named that.
Install Deployer
Use the following command to install it.
1 | cnpm install --save hexo-deployer-git |
This command details will not be repeated here.
Deploy
After all step, and make sure your configuration file is correct, you can execute the following command to deploy your blog to github page.
1 | hexo d |
In this command, ‘d’ represents ‘deploy’. (Deploy your website)
During this time, your should enter your github account and corresponding password.


