If you are an old friend from my blog, you must notice that my blog style has been changed. That’s because I convert my wordpress blog to this hexo blog based on the Github Pages. 😝 It makes me feel more like a Geek~
This tutorial is going to talk about how to use hexo, and I will not mention too much with the usage of Github Pages. The official website has the tutorial. :D
Hexo is a fast, simple and powerful blog framework, and you can write posts in Markdown (The official doc says other languages should be fine as well). Then, it will generate static files with a beutiful theme in seconds.
You need to have: (Installation doc)
If your computer already has these, just install Hexo with npm:
npm install -g hexo-cli
Once Hexo is installed, run these command:
Now you have your hexo blog.
Have a look at the
_config.yml, in this file, you can configure the settings. For example, title, author, language, etc.
You can run your blog by command:
Each time, when you change the code in
_config.yml, you must run
hexo g. Otherwise, it will not make any senses.
localhost:4000 in your browser, you can see your new hexo page. Sometimes, you need to type 0.0.0.0:4000 (If localhost:4000 does not work)
If these errors occurs when you run
hexo g or
Try this command:
npm install hexo --no-optional.
If you want to create a new post, try this command:
hexo new post "My new post"
And this new post will automatically appear in your HomePage.
If you want to enable ‘tags’. For example, xxx.com/tags to present the posts by tags.
You need to run command:
hexo new page tags
The for each post, at the start, add your own tag.
You may pay attention to attribute cover, and it is used for editting the cover picture of that post. The URL should be inside your post own folder.
After you finish your blog, you may want to put it on Github pages as well. Let’s go back to
_config.yml, and add this:
The repo is just your Github Pages Repo. :D
And then run:
If you see
That means you have successfully deployed your blog. 😊
You can download the theme from themes. And in the
_config.yml, remember to change the following lines to your theme:
Hope you will like your Hexo Blog. :-)
Last but not least, for Mac users, I recommend ‘MacDown’ for writting your Markdown. 😎
It can clean the useless tags and categories..