Hello Hexo World
The blog is migrated to Hexo today! Check documentation for more info.
Quick Start
What is Hexo?
Hexo is a fast, simple and powerful blog framework. You write posts in Markdown (or other markup languages) and Hexo generates static files with a beautiful theme in seconds.
Installation Requirements
Installing Hexo is quite easy and only requires the following beforehand:
- Node.js (Should be at least Node.js 10.13, recommends 12.0 or higher)
- Git
Install Hexo
1 | $ sudo npm install -g hexo-cli |
Initialize Hexo
Once Hexo is installed, run the following commands to initialize Hexo in the target
1 | $ hexo init <site-folder> |
Once initialized, here’s what your project folder will look like:
1 | . |
You can configure most settings in _config.yml.
Install Next theme
If you’re using Hexo 5.0 or later, the simplest way to install is through npm:
1 | $ cd hexo-site |
Or you can clone the entire repository:
1 | $ cd hexo-site |
Install hexo-generator-searchdb
This is Search data generator plugin for Hexo.
This plugin is used for generating a search index file, which contains all the necessary data of your articles that you can use to write a local search engine for your blog. Supports both XML and JSON format output.
1 | % sudo npm install hexo-generator-searchdb |
Related Popular Posts
NexT supports the related posts functionality according to hexo-related-posts
1 | % npm install hexo-related-posts --save-dev |
Start Hexo server locally
1 | % cd <site-folder> |
More info: Server
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment
github-pages
Config git login credential
1 | git config --global user.name "username" |
Use one-command deployment if you prefer not to upload your source folder to GitHub
1 | # Install hexo-deployer-git |
Follow the instructions here to change the branch to “gh-pages” in order to build the github pages website.
Check the webpage at username.github.io.
Watch for File Changes
Hexo can watch for file changes and regenerate files immediately. Hexo will compare the SHA1 checksum of your files and only write if file changes are detected.
1 | $ hexo generate --watch |
Deploy After Generating
CNAME file should be added to source folder. Otherwise, the custom domain for github pages will be reset after deploy.
1 | $ ls source |
The content of CNAME file is as below. It includes the domain name of the website.
1 | www.flamingbytes.com |
To deploy after generating, you can run one of the following commands. There is no difference between the two.
1 | $ hexo generate --deploy |