From eb5e3f851e5d275b138ca36e2a30e4f72c12dbbf Mon Sep 17 00:00:00 2001 From: wait4xx Date: Thu, 5 Nov 2026 11:42:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(cms):=20=E9=A1=B5=E9=9D=A2=E6=96=87?= =?UTF-8?q?=E6=A1=88=E5=8F=AF=E7=BC=96=E8=BE=91=E6=80=A7=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=88=E7=BB=93=E6=9E=84=E5=8E=8B=E5=B9=B3=EF=BC=89+=20?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=97=8B=E9=92=AE=E9=80=80=E5=BD=B9=20+=20fa?= =?UTF-8?q?vicon=20=E7=9B=B4=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户实测「瞬间/书架 说明文字」在后台无法编辑。根因:Sveltia 对「可选对象 嵌套可选对象」的子编辑器渲染缺陷线(sveltia-cms #446/#654,双层嵌套正踩 雷区)——压平为单层可选对象 + markdown 直挂,与已验证可编辑的主页/关于 页同构。顺应用户第二问:样式旋钮(字号/颜色/字体三档)整体退役,排版 并入内联类(Insert▸排版,预览直接可见),视觉基线由 .page-note scoped 样式承载(13px/ink-4,与原默认一致零回归);favicon 从贴路径 string 改为 image 直传(落 public/icons/,yaml 存 /icons/…)。 验证: pnpm astro build exit 0;config-check 226 字段全过;content-lint 53 页 0/0/0;E2E 61/61 Spec: none (用户实测报告的后台编辑 bug 紧急修复) Co-authored-by: GLM-5.3 --- content/site/pages.yaml | 24 +++------ public/admin/config.yml | 68 +++++--------------------- src/components/pages/BooksPage.astro | 2 +- src/components/pages/MomentsPage.astro | 2 +- src/content.config.ts | 16 +++--- src/lib/site-content.ts | 57 ++++----------------- 6 files changed, 37 insertions(+), 132 deletions(-) diff --git a/content/site/pages.yaml b/content/site/pages.yaml index d8f2a8f..21aad11 100644 --- a/content/site/pages.yaml +++ b/content/site/pages.yaml @@ -1,21 +1,11 @@ -# 页面标题下的说明文案(瞬间 / 书架):文字、字号、颜色、字体都在这里改。 -# 缺省即回落内置默认,删字段不会破版。 -# 说明:color 取 tokens 里的灰阶层级(ink-1..ink-4);font 取排版类白名单里的字体类。 +# 页面标题下的说明文案(瞬间 / 书架):纯 markdown,后台「页面文案」直接改; +# 排版(字体/颜色)用内联类,与文章正文同一套(编辑器 Insert ▸ 排版 可视化选)。 +# 删字段即回落内置默认,不破版。 moments: - note: - zh: 零碎的记录:随手拍、一句话感想、开源动态。 - en: 'Fragmented notes: casual shots, one-liners, and open-source updates.' - style: - size: 13 - color: ink-4 - font: font-sans + note_zh: 零碎的记录:随手拍、一句话感想、开源动态。 + note_en: 'Fragmented notes: casual shots, one-liners, and open-source updates.' books: - note: - zh: 点一行展开封面与简介 · 置顶的书默认展开 - en: 'Tap a row for the cover and blurb · pinned books start open' - style: - size: 13 - color: ink-4 - font: font-sans # 与改造前一致;想用楷体改成 font-kai + note_zh: 点一行展开封面与简介 · 置顶的书默认展开 + note_en: 'Tap a row for the cover and blurb · pinned books start open' diff --git a/public/admin/config.yml b/public/admin/config.yml index 2223829..8bf0b6b 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -154,69 +154,22 @@ collections: label: 瞬间 / 书架 标题下的说明 file: content/site/pages.yaml format: yaml - hint: 这两页大标题下面那一行字,文字与样式都在这里改 + hint: 这两页大标题下面那一行字的文字;字体/颜色用编辑器 Insert ▸ 排版 内联标注(预览直接可见) fields: - - label: 瞬间页 + - label: 瞬间页说明 name: moments widget: object required: false fields: - - label: 说明文字 - name: note - widget: object - required: false - hint: 支持 markdown 与排版类(字体/颜色) - fields: - - { label: 中文, name: zh, widget: markdown, required: false } - - { label: English, name: en, widget: markdown, required: false } - - label: 样式 - name: style - widget: object - required: false - hint: 留空用全站默认;越界值会被自动夹取(不会破版) - fields: - - { label: 字号(px,11–16), name: size, widget: number, required: false, value_type: int, min: 11, max: 16 } - - label: 颜色 - name: color - widget: select - required: false - hint: 只开放灰阶层级,避免正文被染色 - options: [ink-1, ink-2, ink-3, ink-4] - - label: 字体 - name: font - widget: select - required: false - options: [font-sans, font-serif, font-kai, font-huiwen, font-kuaile, font-xiaowei, font-huangyou, font-mashanzheng, font-liujianmaocao, font-smiley, font-neoxihei] - - label: 书架页 + - { label: 中文, name: note_zh, widget: markdown, required: false, hint: '一行小字;排版(字体/颜色)选中文字 → Insert ▸ 排版' } + - { label: English, name: note_en, widget: markdown, required: false } + - label: 书架页说明 name: books widget: object required: false fields: - - label: 说明文字 - name: note - widget: object - required: false - hint: 支持 markdown 与排版类(字体/颜色) - fields: - - { label: 中文, name: zh, widget: markdown, required: false } - - { label: English, name: en, widget: markdown, required: false } - - label: 样式 - name: style - widget: object - required: false - hint: 留空用全站默认;越界值会被自动夹取(不会破版) - fields: - - { label: 字号(px,11–16), name: size, widget: number, required: false, value_type: int, min: 11, max: 16 } - - label: 颜色 - name: color - widget: select - required: false - options: [ink-1, ink-2, ink-3, ink-4] - - label: 字体 - name: font - widget: select - required: false - options: [font-sans, font-serif, font-kai, font-huiwen, font-kuaile, font-xiaowei, font-huangyou, font-mashanzheng, font-liujianmaocao, font-smiley, font-neoxihei] + - { label: 中文, name: note_zh, widget: markdown, required: false, hint: '一行小字;排版(字体/颜色)选中文字 → Insert ▸ 排版' } + - { label: English, name: note_en, widget: markdown, required: false } - name: home label: 主页设置 file: content/site/home.yaml @@ -309,9 +262,12 @@ collections: hint: '留空 = 内置渐变占位;上传后自动优化为 60px WebP' - label: 站点图标 favicon name: favicon - widget: string + widget: image required: false - hint: 'public 下的路径,如 /icons/my.ico 或 /icons/my.svg;留空回退 /favicon.svg。经「图标」媒体库上传' + # media_folder 按 file 集合语义相对 content/site/ 解析(写 content/site/assets 会嵌套翻倍——5l 实测教训) + media_folder: ../../public/icons + public_folder: /icons + hint: '直接上传 .svg/.ico/.png(建议 64–512px 方图);留空回退 /favicon.svg' - label: 社交链接(顺序即展示顺序) name: socials widget: list diff --git a/src/components/pages/BooksPage.astro b/src/components/pages/BooksPage.astro index 0ae5b84..1130d1f 100644 --- a/src/components/pages/BooksPage.astro +++ b/src/components/pages/BooksPage.astro @@ -78,7 +78,7 @@ const L = { {pinnedCount > 0 && {pinnedCount} {L.pinned}} -

+