前言

终于对 HExLL 进行了全面的更新和优化。本文记录了此次更新的所有内容,供后续参考。

📦 依赖版本升级

Hexo 核心升级

组件 旧版本 新版本
Hexo 6.2.0 8.1.1
hexo-deployer-git 3.0.0 4.0.0
hexo-generator-archive 1.0.0 2.0.0
hexo-generator-category 1.0.0 2.0.0
hexo-generator-index 2.0.0 4.0.0
hexo-generator-tag 1.0.0 2.0.0
hexo-renderer-stylus 2.1.0 3.0.1
hexo-renderer-markdown-it 6.0.1 7.1.1
hexo-algoliasearch 0.3.2 1.0.0

主题版本

  • Butterfly 主题: 4.3.1 → 5.5.3

新增 npm 脚本

{
"dev": "hexo clean && hexo server",
"publish": "hexo clean && hexo generate && hexo deploy",
"algolia": "hexo algolia"
}

🎨 主题美化优化

配色方案更新

从原来的蓝绿色调切换到更现代的紫粉色系:

theme_color:
main: "#6366f1" # 现代紫蓝色
paginator: "#8b5cf6" # 紫色分页
button_hover: "#f472b6" # 粉色悬浮
text_selection: "#8b5cf6" # 紫色选中
link_color: "#a5b4fc" # 浅紫色链接
code_foreground: "#f472b6" # 代码前景色
scrollbar_color: "#6366f1"

背景颜色

  • 旧: #1a1a1a
  • 新: #0f172a (Slate 900,更柔和的深色)

字体优化

font:
global-font-size: 16px # 原 18px,更适合阅读
font-family: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif"
code-font-family: "'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace"

其他优化

  1. 首页布局调整

    • index_site_info_top: 10% → 40%
    • index_top_img_height: 100px → 280px
  2. 启用 URL 锚点: anchor: true

  3. 关闭动态彩带背景: 提升页面性能

🔧 配置文件优化

_config.yml 更新

  • 完善站点 SEO 信息 (subtitle, description, keywords)
  • 优化 Markdown 渲染配置
  • 修正 YAML 语法问题

🐍 md2Hexo 脚本重构

将分散在各目录的简陋脚本重构为统一的现代化工具:

新特性

  • ✅ 命令行参数支持
  • ✅ 交互式模式
  • ✅ 预览模式 (--dry-run)
  • ✅ 配置文件支持
  • ✅ 自动检测已有 front matter
  • ✅ 错误处理和统计报告
  • ✅ 类型提示和文档字符串

使用方法

# 交互式模式
python3 tools/md2Hexo.py

# 预览模式
python3 tools/md2Hexo.py --dry-run

# 使用配置文件
python3 tools/md2Hexo.py --config tools/configs/awesome-cheatsheets.json -d source/_posts/awesome-cheatsheets

# 命令行指定参数
python3 tools/md2Hexo.py --tags "Python,教程" --categories "编程" -d ./some-dir

配置文件示例

{
"tags": ["超级速查表", "coding"],
"categories": ["超级速查表"],
"include_folder_as_tag": true,
"include_folder_as_category": true,
"skip_existing_frontmatter": true,
"exclude_patterns": ["README.md", "LICENSE"]
}

📁 新目录结构

scripts/
├── md2Hexo.py # 统一转换脚本
├── configs/ # 各项目配置文件
│ ├── awesome-cheatsheets.json
│ ├── c-crashcourse.json
│ └── deeplearning-500.json
└── update.sh # 服务器同步脚本 (已有)

🚀 后续更新计划

  • [x] 升级 Butterfly 主题到 5.5.3
  • [ ] 添加 GitHub Actions 自动构建
  • [ ] 考虑添加评论系统 (Giscus)
  • [ ] 优化图片 CDN 配置
  • [ ] 清理无效的旧文章

📝 更新命令

# 1. 安装新依赖
rm -rf node_modules package-lock.json
npm install

# 2. 本地预览
npm run dev

# 3. 构建并部署
npm run publish

总结

此次更新主要解决了空置已久的技术债务,将项目升级到现代化的技术栈,并优化了开发体验。Hexo 8.x 带来了更好的性能和更多特性,Butterfly 5.5.3 提供了更优秀的视觉效果。


版本: v2.0.0