这是一个基于 Hexo 搭建的个人技术博客源码仓库,使用 hexo-theme-redefine 主题,并通过 GitHub Pages 自动构建发布。
站点地址:https://qingchenjia.github.io/
博客内容主要记录后端开发、服务部署和个人建站实践,当前文章覆盖:
- Hexo 博客搭建与 GitHub Pages 部署
- Spring Boot、MyBatis-Plus、Knife4j、JWT、HTTPS、Redis 等后端实践
- Nacos、OpenFeign、RabbitMQ 等微服务组件使用
- Nginx、Docker、CentOS 基础环境配置
- Hexo
8.x - Node.js
20(GitHub Actions 构建环境) - 主题:
hexo-theme-redefine - 部署:GitHub Pages / GitHub Actions
- 主要插件:
hexo-asset-imagehexo-deployer-githexo-generator-archivehexo-generator-categoryhexo-generator-indexhexo-generator-taghexo-renderer-markedhexo-renderer-stylus
.
├── .github/
│ ├── dependabot.yml
│ └── workflows/pages.yml
├── scaffolds/ # Hexo 文章、页面、草稿模板
├── source/
│ ├── _posts/ # 博客文章与文章资源
│ └── assets/images/ # 站点头像、首页背景等公共资源
├── themes/ # 本地主题目录
├── _config.yml # Hexo 主配置
├── _config.redefine.yml # Redefine 主题配置
├── package.json
└── package-lock.json
建议使用 Node.js 20 或兼容版本。
npm install
npm run server默认本地预览地址:
http://localhost:4000
# 清理生成文件
npm run clean
# 生成静态文件到 public/
npm run build
# 启动本地预览服务
npm run server
# 使用 Hexo git deployer 部署到 _config.yml 中配置的 deploy.repo
npm run deploy新建文章:
npx hexo new "文章标题"文章源文件存放在 source/_posts/。本项目已启用 post_asset_folder: true,如果文章需要配图,可将图片放在与文章同名的资源目录中,例如:
source/_posts/文章标题.md
source/_posts/文章标题/example.png
公共图片资源放在 source/assets/images/,例如站点头像和首页背景图。
_config.yml:Hexo 主配置,包括站点 URL、永久链接、文章渲染、主题选择和hexo deploy目标仓库。_config.redefine.yml:Redefine 主题配置,包括站点标题、作者、头像、首页横幅、颜色、导航栏和社交链接。.github/workflows/pages.yml:推送到master分支后,GitHub Actions 会安装依赖、执行npm run build,并将public/发布到 GitHub Pages。
推荐发布源码变更到当前仓库后,由 GitHub Actions 自动构建 GitHub Pages:
git add .
git commit -m "docs: update README"
git push origin master也可以使用 Hexo 的部署命令,将生成结果推送到 _config.yml 中配置的 deploy.repo:
npm run clean
npm run build
npm run deploypublic/是 Hexo 构建产物,不建议手动维护。db.json是 Hexo 生成缓存文件,可在需要完整重建时配合npm run clean重新生成。- Dependabot 已配置为每日检查 npm 依赖更新。