使用Hexo搭建博客框架
To record some basic operations about Hexo and test some new ideas, I decided to create a blog again!
1. Build the website
- First, we need to build the Hexo Framework.
-
Enter the user’s content:
$ cd ~/
-
Creat a new folder to store the website:
$ mkdir BlogTest
-
Enter the Website’s content:
$ cd BlogTest
-
Install the Hexo into the folder: (If you have done this, skip it)
$ npm install -g hexo
-
Build a new website:
$ hexo init
-
Build the content:
$ npm install
-
Build a new Blog:
$ hexo new "title"
-
Generate the static files:
$ hexo generate
-
Start server: (Website: http://localhost:4000/)
$ hexo server
-
Next, in your github, you need to build a new Repository:
username.github.io(eg.BlogTest.github.io)
-
Then you can install Git-deployer-Plug-in.
$ npm install hexo-deployer-git --save
-
Finally, deploy your _config.yml.
deployway
And in the end of this, you will find as follows:
-
So you need to change it.
deploy: type: git repo: https://github.com/username/name.github.io.git(eg.https://github.com/Yeast/BlogTest.github.io.git). branch: master
Note that the colon is followed by a space. Then you can deploy your website from local to Github.
Common commands
- Common commands:
-
Generates static files
$ hexo generate
-
Deploy the website
$ hexo deploy
-
Cleans the cache file (db.json) and generated files (public).
$ hexo clean
-
List sources in this website
$ hexo list
-
Show the hexo’s version
$ hexo version
I just want to record some common operations that I will use usually. Hope it can help you. If you want to know more, you can visit the Commands.