🦋 Hexo Butterfly主题个人网站完整配置指南
本文详细记录了我搭建个人博客网站的完整过程,包含主题配置、评论系统、页面创建等所有步骤。
📚 参考资料
1️⃣ 基础配置
1.1 准备工作
🔧 配置文件管理
为了减少升级主题后带来的不便,建议使用以下方法:
在 Hexo 根目录创建 _config.butterfly.yml
文件,并把主题目录的 _config.yml
内容复制进去。
1 2 3 4
| ├── _config.yml ├── _config.butterfly.yml └── themes/butterfly/_config.yml
|
⚠️ 注意:
- 不要删除主题目录的
_config.yml
- 优先级:
_config.butterfly.yml
> themes/butterfly/_config.yml
- 以后只需在
_config.butterfly.yml
中配置
1.2 代码仓库管理
📂 双仓库策略
建议将代码仓库和网站仓库分开管理:
1 2 3 4 5
| https://github.com/用户名/hexo-blog-source
https://github.com/用户名/用户名.github.io
|
🔗 本地连接代码仓库
1 2 3 4 5 6 7 8
| git remote -v
git remote add origin https://github.com/用户名/hexo-blog-source.git
git push -u origin main
|
1.3 网站更新流程
1 2 3 4 5 6 7 8
| hexo clean
hexo generate
hexo deploy
|
2️⃣ 评论系统配置
2.1 Waline 评论系统部署
🚀 部署步骤
① 一键部署到 Vercel
- 访问 Waline 官方部署链接
- 点击 “Deploy with Vercel”
- 连接 GitHub 账号
- 设置项目名称(如:
my-waline-comments
)
- 直接 Deploy
- 获取部署地址(如:
https://my-waline-comments.vercel.app
)
🗄️ 数据库配置(推荐)
为什么需要配置数据库?
不配置数据库 |
配置 LeanCloud |
✅ 零配置,5分钟搞定 |
✅ 数据永久保存 |
✅ 适合测试 |
✅ 支持邮件通知 |
❌ 重部署丢失数据 |
✅ 可备份导出 |
❌ 功能受限 |
✅ 后台管理 |
LeanCloud 配置步骤:
注册 LeanCloud
获取密钥
1 2 3 4 5 6
| 应用设置 → 应用凭证
需要的信息: - AppID: xxxx-gzGzoHsz - AppKey: xxxx-bjGzoHsz - MasterKey: xxxx,master
|
配置 Vercel 环境变量
1 2 3 4 5 6
| Settings → Environment Variables
添加三个变量: LEAN_ID = 你的AppID LEAN_KEY = 你的AppKey LEAN_MASTER_KEY = 你的MasterKey
|
重新部署项目
⚙️ 主题配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| comments: use: waline text: true lazyload: false count: true card_post_count: true
waline: serverURL: https://comments.mice33.top/ bg: pageview: true option: meta: ['nick', 'mail', 'link'] requiredMeta: ['nick'] lang: 'zh-CN' locale: placeholder: '欢迎留言讨论~' avatar: 'monsterid' avatarCDN: 'https://www.gravatar.com/avatar/' wordLimit: 0 pageSize: 10
|
3️⃣ 页面内容配置
3.1 菜单配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| menu: 主页: / || fas fa-home 博文 || fa fa-graduation-cap: 分类: /categories/ || fa fa-archive 标签: /tags/ || fa fa-tags 归档: /archives/ || fa fa-folder-open 生活 || fas fa-list: 分享: /shuoshuo/ || fa fa-comments-o 相册: /photos/ || fa fa-camera-retro 音乐: /music/ || fa fa-music 影视: /movies/ || fas fa-video 留言板: /comment/ || fa fa-paper-plane 关于笔者: /about/ || fas fa-heart
|
3.2 页面创建
📄 基础页面创建命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| hexo new page about
hexo new page comment
hexo new page categories
hexo new page tags
hexo new page shuoshuo hexo new page photos hexo new page music hexo new page movies
|
📝 页面内容示例
关于页面 (source/about/index.md
):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| --- title: 关于我 date: 2025-08-01 05:53:28 type: about comments: true ---
这里是我的个人技术博客,主要分享: - 生信技术心得 - 生物学习笔记 - 生活感悟/评论 - 有趣的故事
- **序列分析**: BLAST, ClustalW, MEGA - **基因组学**: BWA, GATK, SAMtools - **转录组学**: DESeq2, edgeR, GSEA
- **R语言**: 数据分析、可视化 - **Python**: 生信脚本、机器学习 - **Shell/Bash**: Linux环境数据处理
- **邮箱**: mice33@example.com - **GitHub**: https://github.com/mice33 - **ORCID**: 0000-0000-0000-0000
欢迎在下方留言交流 👇
|
4️⃣ 如何创建博文
4.1 创建新文章
🖊️ 基本命令
1 2 3 4 5 6 7 8
| hexo new "文章标题"
hexo new draft "文章标题"
hexo new post "文章标题"
|
📍 实际示例
1 2 3 4
| hexo new "生信入门:BLAST基本使用方法" hexo new "Python处理FASTA文件的技巧" hexo new "R语言数据可视化入门"
|
4.2 文章模板
创建后的文章位于:source/_posts/文章标题.md
完整的文章模板:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| --- title: 生信入门:BLAST基本使用方法 date: 2025-08-01 05:53:28 updated: 2025-08-01 05:53:28 tags: - 生物信息学 - BLAST - 序列比对 - 入门教程 categories: - 生信技术 - 工具使用 author: mice33 description: 详细介绍BLAST的基本概念和使用方法,适合生信初学者 keywords: BLAST, 生物信息学, 序列比对, 生信入门 top: false cover: https://example.com/blast-cover.jpg ---
BLAST(Basic Local Alignment Search Tool)是生物信息学中最常用的序列比对工具...
<!-- more -->
- 用于核酸序列对核酸数据库的比对 - 适用于基因序列、转录本序列等
- 用于蛋白质序列对蛋白质数据库的比对 - 适用于蛋白质功能注释
```bash
blastn -query input.fasta -db nt -out result.txt -outfmt 6
|
4.3 Front-matter 字段说明
字段 |
说明 |
示例 |
title |
文章标题 |
"BLAST使用教程" |
date |
发布日期 |
2025-08-01 05:53:28 |
updated |
更新日期 |
2025-08-01 05:53:28 |
tags |
标签(数组) |
["生信", "教程"] |
categories |
分类(数组) |
["技术", "生信"] |
description |
文章描述 |
SEO 优化用 |
cover |
封面图片 |
文章头图 |
top |
是否置顶 |
true/false |
4.4 发布流程
1 2 3 4 5 6 7 8 9 10 11 12 13
| hexo new "你的文章标题"
notepad source/_posts/你的文章标题.md
hexo server
hexo clean hexo generate hexo deploy
|
这份配置指南帮到你了吗?如果有任何问题,欢迎在评论区讨论! 💬