Build up blog site using GitHub and Hexo
Documentation for hexo: https://hexo.io/zh-cn/docs/
1.Prepare a GitHub account
2.Install git
3.Install NodeJS
Download the installation package: https://nodejs.org/zh-cn/download/package-manager
Enter node -v in cmd to view the node version
Enter npm -v in cmd to view the npm version
4.Create a repository on github
Name the code repository <username>.github.io
Create a file named index.html for the home page
4.Install Hexo
Install Hexo: https://hexo.io/zh-cn/
1 |
|
Enter hexo -v in cmd to view the node version
5.build up blog
1 |
|
Click on the link, we can see a web page
6.change the theme
Fluid theme: https://github.com/fluid-dev/hexo-theme-fluid
Download the zip pack, unzip it to the themes directory, and rename it fluid
change the language and theme in _config.yml
language: zh-CN
theme: fluid
enter hexo new page about to build an about page
edit the about page
7.Create an article
enter $ hexo new [layout] <title> to create a new article
Create an image directory in the source directory for storing pictures, use ![Alt text](image/picture.png) to insert the image
8.Personalized page display
Modify the _config.yml file in the blog directory
Modify the _config.yml file in the fluid directory
9.Added the read volume statistics function
Sign up for LeanCloud account, complete real-name authentication, and verify email
Create App, Open the APP and click Settings-App Keys
Modify the _config.yml file in the fluid directory
Set app_id, app_key, server_url and other information to the corresponding positions
The effect:
Display website PV and UV statistics
The effect:
10.Enable comment
Modify the _config.yml file in the fluid directory
Set app_id, app_key and other information to the corresponding positions
The effect:
11.Publish to GitHub pages
install hexo-deployer-git
npm install hexo-deployer-git –save
Modify the _config.yml file in the Blog directory
Deploy to github:
hexo g -d
Go to yjkyjkyjk.github.io in a browser:
12.Customize the domain in the GitHub Page
I registered a domain name in Tencent Cloud. The real-name authentication needs to wait for a few minutes
DNS resolution:
add CNAME file in source directory
Enter your domain name in the CNAME file
hexo clean
hexo d -g
Add a custom domain name on Github Pages
Type yjk.ac.cn into your browser and you’ll see the blog page
If you type yjkyjkyjk.github.io in your browser, you will be redirected to yjk.ac.cn
Unexpected problems
- npm path is faulty
This problem is probably caused by the fact that I merged disk C with disk D, resulting in no disk D at present
Open .npmrc with Wordpad and change D: to C:
set prefix and cache:
npm config set prefix “C:\Program Files\nodejs\node_global”
npm config set cache “C:\Program Files\nodejs\node_global”
add NODE_PATH:
- Network delay problem:
use a VPN:
- hexo not found
NodeJS was probably not added to the path