Limour

Limour

临床医学在读。

[Record] Setting up Hexo on GitHub

Install Hexo#

conda activate node
npm i hexo-cli -g
hexo -v
hexo init
npm install

Configure hexo-deployer-git#

  1. npm install hexo-deployer-git --save
  2. echo hexo.limour.top > source/CNAME
  3. Create a repository named <github usrname>.github.io
  4. Create a gh-pages branch in the repository
  5. Modify the settings in settings/pages as follows
    msedge_XyHk2KRsKh
  6. Build GitHub file acceleration
  7. Follow the instructions of hexo-deployer-git to obtain a token
    msedge_JuMQr5HytR
  8. 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
'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#

  1. Create a free M0 database on the MongoDB official website, select Singapore as the region, and allow 0.0.0.0/0 to access.
  2. In the Waline project on Vercel, change the Region to Singapore in Settings/Functions.
  3. Record the connection information in the MongoDB connection, with the following options:
  4. Select Drivers as the connection method, Driver is Node.js, and Version is 2.2.12 or later.
  5. Enter the Waline management background and export the data.
  6. Delete the LEAN-related environment variables in Vercel and add the MongoDB connection information according to the instructions.
  7. In Vercel/Deployments, select the appropriate branch, click the three dots next to it, and select Redeploy.
  8. Enter the Waline management background, re-register, and import the data.
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
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.