如何使用Hexo写文章?

如何使用Hexo写文章?
Everett如何使用Hexo写文章?
以下是针对 Hexo + Butterfly 主题的详细文章创建教程:
一、基础文章创建
- 新建文章
- 推荐使用命令生成:
1
hexo new "文章标题"
会在source/_posts
目录生成.md
文件
- 或手动创建:
直接在source/_posts
新建文章标题.md
- 基础文件格式
1 | --- |
二、Front-matter 进阶配置(Butterfly 主题专属)
1 |
|
三、分类与标签设置
- 创建分类/标签页(首次需要)
1
2hexo new page categories
hexo new page tags - 修改生成的页面文件
1
2
3
4
5---
title: 分类
date: 2023-08-20 14:30:00
type: "categories"
--- - 配置主题配置文件 (_config.butterfly.yml)
1
2
3menu:
分类: /categories/ || fas fa-folder-open
标签: /tags/ || fas fa-tags
四、文章发布流程
- 编写完成后本地预览:
1
hexo clean && hexo s
- 生成静态文件:
1
hexo g
- 部署到服务器:
1
hexo d
五、Butterfly 主题特色功能
- 文章置顶:
1
sticky: 100 # 数值越大越靠前
- 文章封面样式:
1
2
3
4
5
6
7cover:
# 图片路径
img: /images/cover.jpg
# 是否暗化
darken: true
# 暗化程度 0-1
darken_opacity: 0.3 - 图库支持:
1
2
3
4{% gallery %}


{% endgallery %}
六、推荐目录结构
1 | source |
七、常见问题处理
- 标签/分类页面404:
- 确认已执行hexo new page
命令
- 检查主题配置中菜单项是否正确 - 图片不显示:
- 使用相对路径时确保开启 post_asset_folder
- 在配置文件中设置:
1
post_asset_folder: true
- Butterfly 特效不生效:
- 确保主题版本 ≥ 4.0.0
- 检查主题配置中的对应功能开关
建议配合 Hexo 官方文档 (https://hexo.io/zh-cn/docs/) 和 Butterfly 主题文档 (https://butterfly.js.org/) 使用更佳。
评论
匿名评论隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果