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
download
it. Then, it will be installed at /usr/local/bin .
After that, you canvalidate
it 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
problems
in this way, and through another waysolved
it:
sudo npm install -g hexo-cli --unsafe-perm |
Initialize Hexo
- Create a folder(e.g.
blog
) andcd
into it. Initialize
blog and download a series of files.- Install
npm
. - hexo
generate
andserver
.
$ mkdir blog |
Install Themes
Note that there are more than one
_config.yml
in the blog file.
- one is in
root directory
.- and every
themes directory
also 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
issues
anddocuments
of 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 Page
andCoding Page
could be choose. More details can be find in their websites. - Domain:
I register.top
domain 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 xxx
to 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