feat(cms): 后台扩展五件——关于页 markdown 化/社交/头像/favicon/分轨首页

- T1 关于页=markdown 文档:about.yaml intro 扩为多段 markdown(zh/en),
  AboutPage 用 @astrojs/markdown-remark 的 createMarkdownProcessor(进程
  内单例复用)+ set:html 渲染,正文 p/ul/strong/a 对齐站点排版;名片与
  技能卡结构不动
- T2 社交链接单一数据源:home.yaml socials[](label/url/icon)+
  SocialLinks.astro(图标注册表白名单:github/rss/email/bilibili/x,
  未登记 icon 回退纯文字),首页 zh/en 内联硬编码社交块删除
- T3 头像与 favicon 可上传:schema avatar: image()(Astro Image 出 60px
  WebP,未设回退渐变 SVG);home.yaml favicon → BaseLayout link[rel=icon]
  按扩展名给 type,留空回退 /favicon.svg
- T4 首页分轨:PostList perTrack → 阅读轨/技术轨两段各限 6,各自出口
  (阅读→/books/ 技术→/archives/,en 同构);E2E 断言改为两段各≤6+各自
  出口+阅读在前
- T5 后台列表日期:posts summary「{{pubDate}} · {{title}}」、moments
  「{{fields.pubDate}} · {{fields.text}}」+sortable;photos 无 frontmatter
  日期(JSON sidecar)保持分组 · 标题并在文档写明原因
- 顺手修 content-lint 漏报:中文文件名在 HTML 里为 %XX 编码,脚本直接
  拼盘上路径导致 6 条"缺图"误报 → 加 decodeURI
- 清理:删除书封误传遗留的双重嵌套目录文件

车道:op-gitea(5/5,build+E2E 37/37+lint 47 页 0/0/0);收编复验:
build 46 页 + E2E 37/37 连跑(首跑两红为车道并发构建擦 dist 的瞬时态,
复跑绿)

验证: node v26.13.0 + astro 7.4.4 全量构建 46 页 exit 0;E2E 37/37;
      content-lint 0/0/0;books details/命令面板 playwright 实测

Spec: none (后台能力扩展,车道级交付)

Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-11-02 15:46:41 +08:00
1 parent 227bc24797
commit 328ab68f18
16 files changed
+409 -146

No files matched your search

+35 -5
View File
@@ -26,7 +26,7 @@ collections:
create: true
# 中文主稿;英文为 TMT 预翻译入仓的 .en.md(posts-en 集合不在后台,防误改译文)
slug: '{{slug}}'
summary: '{{title}} · {{category}}'
summary: '{{pubDate}} · {{title}}'
sortable_fields: [pubDate, title]
# 注意:Sveltia 对 folder 集合的 media_folder 按"相对集合目录"解析
# (写成 content/posts/assets 会二次嵌套成 content/posts/content/posts/assets,
@@ -66,6 +66,7 @@ collections:
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
summary: '{{fields.pubDate}} · {{fields.text}}'
sortable_fields: [pubDate, text]
fields:
- { label: 时间, name: pubDate, widget: datetime, date_format: 'YYYY-MM-DD', time_format: false, format: 'YYYY-MM-DD' }
- { label: 文字, name: text, widget: text, required: false, hint: '一句话(与图片至少填一项)' }
@@ -84,6 +85,8 @@ collections:
media_folder: ''
public_folder: ''
summary: '{{fields.group}} · {{fields.title}}'
# 照片无 frontmatter 日期(JSON sidecar,时间在 exif/文件侧)——列表按标题/分组排序
sortable_fields: [title, group]
fields:
# title 必填:Astro schema z.string() 无 .optional(),omit 纪律下必需且有值才会落键(空 title 会让 main 不可构建)
- { label: 标题, name: title, widget: string, required: true }
@@ -110,6 +113,9 @@ collections:
- name: home
label: 主页设置
file: content/site/home.yaml
# 头像上传落 content/site/assets/,yaml 写 ./assets/xxx(Astro 图片管线优化)
media_folder: content/site/assets
public_folder: ./assets
fields:
- label: 身份语
name: tagline
@@ -117,17 +123,41 @@ collections:
fields:
- { label: 中文, name: zh, widget: string, required: false }
- { label: 英文, name: en, widget: string, required: false }
- label: 头像(可选)
name: avatar
widget: image
required: false
hint: '留空 = 内置渐变占位;上传后自动优化为 60px WebP'
- label: 站点图标 favicon
name: favicon
widget: string
required: false
hint: 'public 下的路径,如 /icons/my.ico 或 /icons/my.svg;留空回退 /favicon.svg。经「图标」媒体库上传'
- label: 社交链接(顺序即展示顺序)
name: socials
widget: list
required: false
summary: '{{fields.label}} → {{fields.url}}'
fields:
- { label: 名称(无障碍文字), name: label, widget: string }
- { label: 链接, name: url, widget: string }
- label: 图标
name: icon
widget: select
required: false
options: [github, rss, email, bilibili, x]
hint: '不在列表里的留空 → 显示纯文字按钮'
- name: about
label: 关于页
file: content/site/about.yaml
fields:
- label: 身份陈述段
- label: 正文(markdown,多段)
name: intro
widget: object
hint: 渲染在「关于」标题下方、名片之上;留空用默认文案
hint: 渲染在「关于」标题下方、名片之上;支持段落/列表/粗斜体/链接;留空用默认文案
fields:
- { label: 中文, name: zh, widget: text, required: false }
- { label: 英文, name: en, widget: text, required: false }
- { label: 中文, name: zh, widget: markdown, required: false }
- { label: 英文, name: en, widget: markdown, required: false }
- name: opensource
label: 开源页
file: content/site/opensource.yaml