Hexo
Introduction
Hexo is a static website builder based on nodejs and markdown which supports remote deployment and theme customization.
Hexo Installation
Node.js
The installation program,including node and npm.
1 | $ node -v # check the version of node |
The step of installation:
1 | $ npm install -g cnpm --registry=http://registry.npm.taobao.org # install the cnpm manager of taobao |
Git
In windows, all the command line commands should be run in Git bash. Github can serve as the remoete blog of our local hexo blog:
Create a new repositry in github,whose name is YourGithubName.github.io;
Install the git deployment plugin;
1
$ cnpm install --save hexo-deployer-git
Configure _config.yml.
1
2
3deploy:
type: git
repo: https://github.com/YourGithubName/YourGithubName.github.io.gitVisit remote blog through https://YourGithubName.github.io/.
Hexo theme
Download the specific theme from github:
1 | $ git clone https://github.com/themename.git themes/themename |
Configure _config.yml:
1 | theme: themename |
Then, configure the theme with the help of its manual.
Hexo Command
Create a folder in computer and use this folder as the root of our blog.
1 | $ hexo init [folder] |
Create a new blog:
1 | $ hexo new <title> |
Create categories or tags:
1 | $ hexo new page categories |
Once we edit our blog,we should:
Clean cache files.
1
$ hexo clean
Generate new public blog. That is the content we use to build our website.
1
$ hexo g
Start our server:
1 | $ hexo s |
Deploy our blog to remote site:
1 | $ hexo d |
All the file created in command line will be placed in /source.
Local article link
Jump to the specific local article:
1 | {% post_link 'YourPostName' LinkName %} // the default linkname is the name of article |
Jump to the specific catalog of local article:
1 | // Use '#' for all levels of catalog |
You can also use:
1 | [LinkName]({% post_path 'YourPostName' %}#CatalogName) |
But when you configure the path of your local image like this: Image, this method will fail.
If your
CatalogNamehas space, you should replace the space to-. The same toYourPostNameif you do not use''.
Custom article priority
See Hexo设置文章的优先级别.
Some bugs
Only show Chinese '
This is a setting bug of marked renderer, turning off smartypants can solve it:
1 | marked: |