本仓库为 Jekyll 博客(Hux/BY Blog 主题 + 自定义暖色调首页),托管于 GitHub Pages。 本次做了增量升级(未迁移框架、未破坏现有首页设计),新增:文章系统(分类/标签/搜索)、 Giscus 留言板、SEO 全套优化、GA4 统计、GitHub Sponsors 打赏。
所有待替换项都在 _config.yml 中用 TODO: 用户替换 标注,共 3 处:
_config.yml 的 ga4_track_id + 首页 index.html head(2 处)。gtag/js 请求;或等 24h 在 GA「实时」报告看到访问。_config.yml 第 83、85 行
repo_id: "REPLACE_WITH_YOUR_REPO_ID"
category_id: "REPLACE_WITH_YOUR_CATEGORY_ID"
kjlintong/kjlintong.github.io 需开启 Discussions:仓库 Settings → 拉到最底 General → Features → 勾选 Discussions。kjlintong/kjlintong.github.io,勾选「Discussion 分类」→ 页面会自动生成 data-repo-id 和 data-category-id,复制填入。_config.yml 里 Gitalk 的 clientSecret 明文泄露在公开仓库,本次已全部移除并更换为 Giscus(Giscus 无需暴露任何密钥,更安全)。_config.yml 的 ko_fi: "https://ko-fi.com/ryanlin65969"(国际)与 afdian: "https://afdian.com/a/ryanlintong"(中国)。github_sponsors 已更名为 ko_fi。| 文件 | 作用 |
|——|——|
| blog/index.html | 博客列表页 /blog/:文章列表 + Fuse.js 全文搜索框 |
| categories.html | 分类归档页 /categories/ |
| search.json | Jekyll 构建时自动生成的文章搜索索引(Fuse.js 数据源) |
| js/fuse.min.js | Fuse.js 7.0 本地库(已下载,离线可用) |
| robots.txt | 搜索引擎抓取规则 + Sitemap 引用 |
| 文件 | 改动 |
|——|——|
| _config.yml | 清理 Gitalk 密钥 → 换 Giscus;新增 GA4 / Sponsors / author(JSON-LD) / jekyll-sitemap 插件;URL 改为 /blog/:title/ |
| _includes/head.html | 动态 Title/Description/Keywords + Open Graph + Twitter Card + JSON-LD + GA4 |
| _includes/nav.html | 固定导航(Home/Blog/分类/标签/About) |
| _includes/footer.html | 新增「支持我 · Sponsor」入口 |
| _layouts/post.html | Gitalk → Giscus;新增文章底部打赏按钮;修复 featured-tags Liquid 嵌套 bug |
| _layouts/page.html | 修复 featured-tags Liquid 嵌套 bug |
| _layouts/keynote.html | Gitalk → Giscus |
| about.html | Gitalk → Giscus |
| index.html(首页) | head 补 SEO/OG/Twitter/JSON-LD/GA4;导航加「博客」;博客区内链 /blog/ + 删除 CSDN 链接;页脚加 Sponsor 按钮 |
| _posts/*.md | 两篇文章补 categories 和 description 字段 |
| .travis.yml | 移除 jekyll-paginate / 失效 codecov,换 jekyll-sitemap |
| .gitignore | 忽略 .jekyll-cache |
_posts/ 新建 Markdown 文件,命名 YYYY-MM-DD-标题.md。```
/blog/ 列表(按日期倒序)/categories/ 对应分类search.json 索引,纳入全文搜索/sitemap.xml 和 /feed.xml仓库根目录含 _config.yml,GitHub Pages 会自动用 Jekyll 构建,无需任何 CI 配置:
git add -A
git commit -m "feat: blog system + giscus + SEO + GA4 + sponsors"
git push origin master
等待约 1 分钟,访问 https://kjlintong.github.io 即可看到新版本。
本机已配置好 Jekyll 环境(conda 的 jekyll-env),构建命令:
export PATH="/home/ryan/miniconda3/envs/jekyll-env/bin:$PATH"
export GEM_HOME="/home/ryan/miniconda3/envs/jekyll-env/lib/ruby/gems/2.6.0"
export GEM_PATH="/home/ryan/miniconda3/envs/jekyll-env/lib/ruby/gems/2.6.0"
cd /home/ryan/project/kjlintong.github.io
jekyll build # 输出到 _site/
jekyll serve # 或直接预览
kjlintong.github.io,提交 sitemap(https://kjlintong.github.io/sitemap.xml),验证 meta 里的 google-site-verification 已存在。gtag/js 请求,或等 24h 在 GA 实时报告中看到访问。preferred_color_scheme 跟随系统主题;首页是浅色暖调设计,如需暗色可后续再加(本次未动以免破坏现有布局)。文档生成日期:2026-09-02