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
npm install hexo-cli -g

Enter hexo -v in cmd to view the node version

5.build up blog

1
2
3
4
hexo init blog
cd blog
npm install
hexo server

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

https://console.leancloud.cn/

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

https://docs.github.com/zh/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages

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

  1. 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:

  1. Network delay problem:

use a VPN:

  1. hexo not found

NodeJS was probably not added to the path

Reference

https://blog.csdn.net/yaorongke/article/details/119089190

https://cloud.tencent.com/developer/article/2142661


Build up blog site using GitHub and Hexo
http://example.com/2024/07/22/Build up blog site using GitHub and Hexo/
Author
John Doe
Posted on
July 22, 2024
Licensed under