Install Hexo#
conda activate node
npm i hexo-cli -g
hexo -v
hexo init
npm install
Configure hexo-deployer-git#
npm install hexo-deployer-git --save
echo hexo.limour.top > source/CNAME
- Create a repository named
<github usrname>.github.io
- Create a
gh-pages
branch in the repository - Modify the settings in
settings/pages
as follows
- Build GitHub file acceleration
- Follow the instructions of hexo-deployer-git to obtain a token
- Edit
_config.yml
and add the following content
deploy:
type: git
repo: https://oauth2:[email protected]/xxx/https://github.com/limour-blog/limour-blog.github.io.git
branch: gh-pages
token: ghp_xxxxx
name: [email protected] # Registered email of Github
email: [email protected] # Registered email of Github
Configure butterfly theme#
npm install hexo-theme-butterfly --save
npm install hexo-renderer-pug hexo-renderer-stylus --save
mkdir scripts && touch scripts/CDN.js
- Edit
_config.yml
and modify the content as follows
theme: butterfly
- Build jsDelivr proxy
- Edit
scripts/CDN.js
and add the following content
'use strict';
const { filter } = hexo.extend;
// Replace CDN
filter.register('before_generate', () => {
const { asset } = hexo.theme.config;
for (const name in asset) {
asset[name] = asset[name]
.replace('//cdn.jsdelivr.net/', '//your-own-proxy/');
}
}, 99);
Generate and deploy the website#
rm -rf .deploy_git && hexo c && hexo g && hexo d
Domestic proxy acceleration#
Backup the blog#
- Edit
.gitignore
and add_config.yml
git init && git branch -m main
git remote add origin https://oauth2:[email protected]/xxx/https://github.com/limour-blog/limour-blog.github.io.git
git add . && git commit -m 'backup' && git push -u origin +main
Demo address#
Additional: Switch Waline to MongoDB#
- Create a free M0 database on the MongoDB official website, select Singapore as the region, and allow
0.0.0.0/0
to access. - In the Waline project on Vercel, change the Region to Singapore in Settings/Functions.
- Record the connection information in the MongoDB connection, with the following options:
- Select Drivers as the connection method, Driver is Node.js, and Version is
2.2.12 or later
. - Enter the Waline management background and export the data.
- Delete the LEAN-related environment variables in Vercel and add the MongoDB connection information according to the instructions.
- In Vercel/Deployments, select the appropriate branch, click the three dots next to it, and select Redeploy.
- Enter the Waline management background, re-register, and import the data.
Additional: Convert external links to internal links#
- Project address: Github; Instructions
npm i hexo-filter-links --save
- Add configuration to
_config.yml
links:
enable: true
field: "post"
exclude:
- "limour.top"
- "*.limour.top" # Supported in version 1.0.4 and above