AGENTS.md — friesi23-blog (Jekyll 博客)

基于 GitHub Pages + Jekyll + Minimal Mistakes 主题的个人技术博客。


项目概述

部署架构

读者 → 阿里云 Nginx (反向代理 + 缓存) → GitHub Pages (源站)
                                      ↓
                              GitHub Actions (构建 gh-pages 分支)

技术栈


本地开发

# 安装依赖
bundle install

# 开发模式(使用本地 gem 主题,无需网络)
make serve

# 含草稿
make serve DRAFT=1

# 生产模式预览(使用 remote_theme)
make serve PROD=1

# 含草稿 + 生产模式
make serve PROD=1 DRAFT=1

关键机制_config.local.yml 覆盖 _config.yml,在本地禁用 remote_theme、启用 future: true。 生产构建走 JEKYLL_ENV=production


目录结构

blog/
├── _posts/<category>/     # 博文(按分类子目录)
│   ├── ai/                # AI 相关
│   ├── algorithm/         # 算法
│   ├── blog/              # 博客/建站
│   ├── dart/              # Dart 语言
│   ├── deploy/            # 部署运维
│   ├── flutter/           # Flutter
│   ├── misc/              # 杂项
│   ├── nas/               # NAS
│   ├── network/           # 网络
│   └── tools/             # 工具
├── _drafts/               # 草稿(--drafts 时可见)
├── _pages/                # 静态页面(首页、关于、404、监控等)
├── _data/                 # Jekyll 数据文件
│   ├── navigation.yml     # 导航栏
│   ├── authors.yml        # 作者信息
│   └── custom-text.yml    # 自定义文案
├── _includes/             # Liquid 片段(dartpad、github_gist 等)
├── _layouts/              # 自定义布局
├── _sass/                 # 自定义 SCSS
├── _prompts/              # AI Prompt 页面(Jekyll collection)
├── _scripts/              # JS 脚本源码
├── assets/                # 编译后的 CSS/JS/图片
├── ci/                    # CI 脚本(Python + Poetry)
├── templates/             # 文章模板
└── .github/workflows/     # GitHub Actions
    ├── jekyll.yml         # 构建 + 部署 + Sitemap 提交
    └── purge.yml          # 手动清除 Nginx 缓存

写新文章

  1. 参考模板 templates/post.md.template
  2. _posts/<category>/ 下创建文件
  3. 文件名格式: YYYY-MM-DD-标题slug.md
  4. 正文最高使用 ##(H2),主题提供 H1
---
title:  文章标题
author: FriesI23
date:   2024-01-01 08:00:00 +0800
category: blog
tags:   [tag1, tag2]
# excerpt: 可选摘要(用于列表页)
---

分类从以下选择: ai, algorithm, blog, dart, deploy, flutter, misc, nas, network, tools


CI/CD

工作流 文件 触发
构建部署 jekyll.yml push gh-pages / 手动
清除缓存 purge.yml 手动(支持按页面/JS 分别清除)

自定义组件

功能 文件
DartPad 嵌入 _includes/dartpad.html
GitHub Gist 嵌入 _includes/github_gist.html
Keep Android Open 横幅 _includes/keep-android-open-banner.html
Prompt 下载链接 _includes/prompt-download-link.html
自定义侧边栏 _includes/sidebar-custom.html

关键约定


常见问题

问题 解决
remote_theme 下载失败 make serve(默认使用 _config.local.yml
Ruby 版本不匹配 检查 .ruby-version,用 chruby 切换
本地样式异常 确认 _config.local.ymltheme: minimal-mistakes-jekyll 且 gem 已安装