这篇文章记录博客的日常维护方式,方便以后快速修改配置、写文章和发布。

常用位置

  • 站点信息:_config.yml
  • 主题配置:_config.butterfly.yml
  • 自定义样式:source/css/custom.css
  • 文章目录:source/_posts/
  • 图片目录:source/img/
  • 页面目录:source/about/source/photos/source/resources/source/thoughts/
  • GitHub Pages 部署:.github/workflows/pages.yml

新建文章

1
npx hexo new post "文章标题"

文章开头建议保留这些字段:

1
2
3
4
5
6
7
8
9
---
title: 文章标题
date: 2026-05-31 00:00:00
categories: 技术分享
tags:
- 标签
description: 一句话说明这篇文章解决什么问题。
cover: /img/default-cover.png
---

本地预览

1
2
npm run clean
npm run server

浏览器打开:

1
http://localhost:4000

发布

1
2
3
git add .
git commit -m "update blog content"
git push origin main

推送后 GitHub Actions 会自动构建并发布到 GitHub Pages。