Repository navigation
feat(docs): add homepage stats and recent updates - #36
Conversation
- Add an announcement block, site statistics, a recent-updates list and quick links to the homepage. - Add a build-time data loader (docs/.vitepress/data/updates.data.ts) that collects page titles and git last-commit dates, and derives the page and section counts from the docs directory. - Document the new data directory in AGENTS.md.
The homepage recent-updates loader derives each page date from `git log`, which reports the same tip date for every file on a shallow clone and degrades the list to alphabetical order.
- Rename the loader to updates.data.mts so Vite loads it as ESM; this removes the configLoader/ESM-syntax build warning. - Format page dates in a fixed time zone (UTC+8) so local and CI builds agree. - Exclude the homepage from both the recent-updates list and the "last updated" statistic so the two stay consistent. - Add datetime to the time element and document the rename in AGENTS.md.
3315044 to
521e2b3
Compare
There was a problem hiding this comment.
ℹ️ 无阻塞问题 — 有一条小建议放在行内评论,其余核对都过了。
Reviewed changes
- 首页内容扩展(
docs/index.md) — hero/features 之下新增班级公告、站点速览统计卡、最近更新列表与热门直达快捷链接,多语言混排与全角标点均符合站内约定。 - 构建期数据加载器(
docs/.vitepress/data/updates.data.mts) — 新增defineLoader:标题按 frontmatter → 首个 H1 → 文件名兜底;日期逐页取git log -1,缺失时回退 mtime;时区固定东八区输出,本地与 CI 构建结果可复现。 - CI 完整历史检出(
.github/workflows/ci.yml) — checkout 加fetch-depth: 0,否则浅克隆里每个文件git log都报 tip 日期,列表五条日期会完全相同。 - 7S 原始页标题澄清(
docs/class/7s-original.md) — frontmatter title 改为「宿舍 7S 原始内容」,与侧边栏文案一致,最近更新列表里两条 7S 不再重名。 - AGENTS.md — 补充
docs/.vitepress/data/目录与 watch 相对解析的说明。
本地复跑了 pnpm docs:build,无警告;dist/index.html 与内联数据核对过:统计 12 页 / 4 栏目、top-5 链接和日期与 git log 一一对应,快捷链接目标全部存在。委员会验收 OK。评论区那条是防未来的健壮性小建议,不阻塞本次合并(作者在 PR Notes 里自己标记的两个跟进项也认可,不重复展开)。
GLM Flash | 𝕏
There was a problem hiding this comment.
ℹ️ 增量复查无新问题 — 唯一实质变化是 rebase 时删掉了本分支上那条 7S 标题提交,理由成立。
Reviewed changes
- rebase 最新
main后的分支调整 — 相对上轮(3315044)唯一的实际增量是移除了本分支修改docs/class/7s-original.mdfrontmatter title 的提交:#35 已在 main 用「学生宿舍 7S 管理标准(原始版)」解决了同一个重名问题,本分支再改一遍只会徒增冲突,删得对。已复跑pnpm docs:build(无警告),验证最近更新列表五条条目不再重名、统计卡仍为 12 页 / 4 栏目、热门直达链接有效;ci.yml、AGENTS.md、updates.data.mts、docs/index.md与上轮逐字节一致。
两件事顺带说明,都不阻塞本 PR:
- main 上 #35 改了页面标题但没同步
config.mts侧边栏(/class/7s-original的文案仍是「宿舍 7S 原始内容」,改成「学生宿舍 7S 管理标准(原始版)」更协调)——这属于 #35 的遗留,不在本 PR diff 范围内,留给后续处理。 - 上一轮评审里
extractTitle围栏兜底那条行内小建议还挂着,不急于本次处理,作者改完我可以做最终放行。
GLM Flash | 𝕏
Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
There was a problem hiding this comment.
✅ 没有新问题——这轮唯一增量就是落实上轮那条围栏兜底的建议,可以合并了。
Reviewed changes
extractTitle的 H1 兜底改为围栏感知(docs/.vitepress/data/updates.data.mts:52) — 在匹配#一级标题前先按首个```围栏截断,代码块里的#注释行(比如 bash 的# 说明)不会再被当成页面标题。改动只在「没有 frontmattertitle」的兜底分支生效,对现有 12 个页面零影响;我用含围栏注释的样例做了反例验证,行为符合预期。上轮的行内评论线程已回复并标记解决。
复核情况:pnpm docs:build 无警告;构建产物里统计仍为 12 页 / 4 栏目,最近更新五条标题、日期与上轮完全一致。ci.yml 与 AGENTS.md 相对上轮逐字节未动。PR 剩下的两个跟进项(列表用纯 <a> 不走 SPA 导航、timestamp 会序列化进客户端 payload)作者已在 Notes 里说明,属后续优化,不阻塞本次合并。
GLM Flash | 𝕏

Summary
The homepage only had a hero section and six feature cards. This PR adds a
content section below them and fixes a few issues found while reviewing the
change. The branch is rebased on the latest
main(807f779).Changes
Homepage content (
docs/index.md)站点速览statistics cards (documents, sections, last update).最近更新list built from the latest five content pages.热门直达quick links to frequently used pages.Build-time data loader (
docs/.vitepress/data/updates.data.mts)git log -1, falling back to the file mtime when git is unavailable or thefile has no commit yet.
build time.
Follow-up fixes
ci: check out full git history— with the defaultfetch-depth: 1everyfile reports the tip commit date, so the list showed five identical dates in
alphabetical order.
fix(docs): stabilize homepage updates data— ESM file extension (.mts,removes a Vite
configLoaderwarning), fixed UTC+8 date formatting so localand CI builds agree, the same page set for the list and the statistic, and a
datetimeattribute on thetimeelement.The duplicate-title problem that the review also found is already fixed on
mainby #35 (docs/class/7s-original.mdis now titled学生宿舍 7S 管理标准(原始版)),so this branch dropped its equivalent commit during the rebase.
Verification
pnpm docs:buildpasses with no build warnings.docs/.vitepress/dist/index.htmlcontains 12 documents,4 sections and the five most recent pages with distinct titles, correct
links and dates.
quick links render; the console has no Vue or hydration errors.
Notes
Not addressed here (possible follow-ups): links in the list use a plain
<a>and therefore trigger a full page load instead of SPA navigation, and the
timestampfield used for sorting is still serialized to the client.