[个人博客折腾记录] Hexo个人博客配置记录
备份备份,收藏栏都块满了,减轻减轻收藏夹压力
一、项目初始化流程
1. 安装 Hexo(首次)
2. 创建博客项目目录
1 2 3
| hexo init hexo-blog cd hexo-blog npm install
|
3. 本地运行预览
浏览器打开:http://localhost:4000
二、配置主题(Butterfly)
1. 下载 Butterfly
1
| git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
|
2. 修改配置文件 _config.yml
3. 安装依赖插件(如有)
1
| npm install hexo-generator-searchdb --save
|
三、配置 Git 部署
1. _config.yml
中增加部署设置
1 2 3 4
| deploy: type: git repo: https://github.com/你的用户名/你的仓库.git branch: main
|
2. 安装部署插件
1
| npm install hexo-deployer-git --save
|
四、文章写作与发布
1. 创建文章
然后编辑 source/_posts/文章标题.md
文件。
博文内容以md格式写在文件内部
2. 设置分类与标签
1 2 3 4 5 6 7 8 9 10
| --- title: 我的文章 date: 2025-06-17 00:00:00 categories: - 技术 - Hexo tags: - Butterfly 主题 - Hexo ---
|
3. 生成并部署
五、评论系统配置(Waline)
1. 部署 Waline 服务(使用 Vercel)
注 同时还需要去leancloud注册账号并获取Api值(建议国际版,国内版还需要申请域名)
详细可以看这里 Waline, LearnCloud配置教程, Vercel


- 设置环境变量(如
LEAN\_ID
, LEAN\_KEY
,LEAN\_KEY
等) 这边需要注意下 必须要设置

2. 修改 Butterfly 主题配置 _config.butterfly.yml
1 2 3 4
| comment: type: Waline serverURL: https://你的-waline.vercel.app pageview: true
|
配置教程链接:
Hexo博客搭建基础教程(三)
、Butterfly主题的基础配置
3. 若报错 Not initialized
或 404
- 确保你设置好 LeanCloud 的应用
- Waline 后台功能需要 admin 密钥或配置 LC 应用权限
六、自动部署(可选)
1. 使用 GitHub Actions 自动部署 Hexo 到 GitHub Pages
七、可视化管理(可选)
1. 使用 hexo-admin
1
| npm install hexo-admin --save
|
运行:
然后打开 http://localhost:4000/admin
使用后台管理界面。
八、常用命令小结
命令 |
功能 |
hexo new post "标题" |
新建文章 |
hexo new post 文件名 |
新建文件夹 |
hexo g |
生成静态文件 |
hexo s |
本地启动服务预览 |
hexo d |
部署到远程仓库 |
hexo g -d |
好像也是部署到远程仓库(我用的) |
hexo clean |
清除缓存和旧文件 |
九、参考配置工具
- 本地写作:VSCode + Markdown 插件
- 实时预览:hexo s
- 自动化:GitHub Actions
- 评论:Waline
- 搜索:hexo-generator-searchdb
- 主题优化:Butterfly + 自定义配置
如需进一步可视化创作、Web 后台文章管理,可结合 Netlify CMS 或搭建更完整的 CMS 前端。