【记录】在 GitHub 上 搭建 Hexo
Last updated on December 5, 2023 pm
安装 Hexo
1 |
|
配置 hexo-deployer-git
npm install hexo-deployer-git --save
echo hexo.limour.top > source/CNAME
- 建立
<github usrname>.github.io
的仓库 - 仓库新建
gh-pages
分支 - 修改
settings/pages
中的设置如下
- 搭建 GitHub 文件加速
- 按 hexo-deployer-git 的指引获取 token
- 编辑
_config.yml
,添加内容如下
1 |
|
配置 butterfly 主题
1 |
|
- 编辑
_config.yml
,修改内容如下
1 |
|
- 搭建 jsDelivr 反代
- 编辑
scripts/CDN.js
,内容如下
1 |
|
生成网页并推送
rm -rf .deploy_git && hexo c && hexo g && hexo d
国内反代加速
备份博客
- 编辑
.gitignore
,添加_config.yml
1 |
|
演示地址
附加 Waline 换 MongoDB
- MongoDB 官网 新建免费的 M0 数据库,地区选新加坡,放行
0.0.0.0/0
- Vercel 上的 Waline 项目,Settings/Functions 里更改 Region 到新加坡
- MongoDB 连接里记录下连接信息,选项如下
- 选择 Drivers 作为连接方式,Driver 为 Node.js,Version为
2.2.12 or later
- 进入 Waline 管理后台,导出数据
- Vercel 里删除 LEAN 相关的环境变量,按 说明 添加 MongoDB 的连接信息
- Vercel/Deployments 里选择合适的分支,点旁边的三个点,选择 Redeploy
- 进入 Waline 管理后台,重新注册后,导入数据
附加 外链转内链
1 |
|
- 去
_config.yml
添加配置
1 |
|
附加 部署到本地服务器
1 |
|
1 |
|
- 后续更新
1 |
|
附加 添加本地搜索功能
- 为Hexo博客Yilia主题添加本地站内搜索功能 by 码农半亩地
- 修改
node_modules/hexo-theme-fluid/scripts/generators/local-search.js
文件
1 |
|
【记录】在 GitHub 上 搭建 Hexo
https://hexo.limour.top/-ji-lu--zai-GitHub-shang-da-jian-Hexo