Prepare environment
Add yum repo
1 | # yum install -y gcc-c++ make |
Install node and npm
1 | # yum install nodejs |
Install git
1 | # yum install git |
Validate installation
1 | # node -v |
Hexo site
Install Hexo
1 | $ npm install -g hexo-cli |
Create and init your site
Creating your site in your own folder
1 | $ hexo init <folder> |
Mind the path when run npm install cmd
Site folder
1 | . |
List generated files to check result
Hello world
1 | $ hexo generate # Generate static files |
Or:
1 | $ hexo g # In short |
First blog
Create a new blog(in markdown format), if title contains white space, please use quotes
1 | $ hexo new <titile> |
It will create a new post with basic tags in path
Mind: no need to restart server after new/delete/modify posts
One more step further
Common cmd
1 | $ hexo new draft <title> # Create a new draft(like private posts) |
Front-matter
Defines variables of post
1 |
|
Multi-language support
1 | new_post_name: :lang/:title.md |
When you create a new post, the post will be saved to:
1 | $ hexo new "Hello World" --lang tw |
and the URL will be:
1 | http://localhost:4000/tw/hello-world/ |
Themes
New theme
Recommend next, or you can find other themes instead
Clone new theme to website folder
1 | $ cd <folder> |
Enable this theme in site
1 | theme: next |
Config theme
Use next as example, others may be found on their website
1 | language: zh-Hans # Set language |
Plugins
Some common plugins may enhance your website
hexo-wordcount Count total words, minutes to read
hexo-admin Provide admin pages to manage hexo site
hexo-generator-search Index pages and provide local search