This blog records the details about building hexo blogs, as well as deploying it to Github and Coding Pages.
Basic Installation
Install Node.js and Git
install Node.js
Just go to the website and you can
downloadit. Then, it will be installed at /usr/local/bin .
After that, you canvalidateit as follows:
$ node -v |
install Git
Also, you can just download and check your git version as follows:
$ Git --version |
Install Hexo
Now, we can install the Hexo. Note that add sudo to solve the problem of permission. -g refers global install.
$ sudo npm install -g hexo-cli |
I have met some
problemsin this way, and through another waysolvedit:
sudo npm install -g hexo-cli --unsafe-perm |
Initialize Hexo
- Create a folder(e.g.
blog) andcdinto it. Initializeblog and download a series of files.- Install
npm. - hexo
generateandserver.
$ mkdir blog |
Install Themes
Note that there are more than one
_config.ymlin the blog file.
- one is in
root directory.- and every
themes directoryalso have one.
Choose themes
It is possible for us to choose our own themes by the website.
For me, what I like is the hexo-theme-icarus.
Download themes
Now, what we need to do is download it as follows:
$ cd blog |
Change themes
Then, for the _config.yml in root directory : Changing theme: landscape to theme: yilia .
Reload hexo
Last, just reload hexo generate and server .
Customize themes
There are a lot of ways to define your own functions. For me, a simple way is finding a suitalbe theme and just download it. Besides, I visited all the
issuesanddocumentsof offical github.
The following is core functions.
“_config.yml”
This file in root directory represents the global hexo settings , and in themes directory just configure one theme.
root directory
It includes site , themes , deployment , sitemap and so on. My complete configuration pushed at the Github .
icarus directory
Similarly, it contains important settings. Like images , navbar , footer , search , comment, widgets, and other plugins .
Pages & Domain
- Pages:
There areGithub PageandCoding Pagecould be choose. More details can be find in their websites. - Domain:
I register.topdomain in AliCloud , following resolve the URL byCNAME.
Sitemap
- baidusitemap.xml
- sitemap.xml(Google)
Conclusion
This blog just mentioned kinds of core keywords , if you have any question about that, just google or baidu it and then solve it.
Notes:
- npm usage:
sudo cnpm install xxxto use taobao mirrors.- daily commands:
hexo clean,hexo s -g,hexo d -g.
Source Tree
. |
References
[1] Hexo Documents
[2] Icarus Documents & Issues
[3] customize Icarus
[4] deploy git to Github & Coding
[5] push sitemap to Baidu & Google
[6] back up hexo datas to Github