feat(content): 瞬间/书架标题下的话语改为后台可编辑(5j T3)
用户原话:「瞬间、书架大标题下的话语我从哪里去改?包括其字号颜色还有字体」——
此前这两行是硬编码(瞬间来自 i18n 字典、书架是组件里的字面量),后台完全改不了。
- 新增 sitePages 单例(content/site/pages.yaml)+ pageNote() 访问器:note 走富文本
行内管线,空则回落内置默认(原硬编码两句逐字搬入 PAGE_NOTE_DEFAULTS)
- 样式只开放三档并全部夹取:size 11–16px、color 仅 ink-1..ink-4、font 仅排版类白名单
—— 后台可填任意值,不能让它破版或染色
- **关键坑**:字体类不能只挂 class——global.css 的 .font-kai/.font-sans 全挂在富文本
容器作用域(.prose-*/.rich/.mom-text/.prose-body),裸 .page-note.font-kai 拿不到
规则(实测第一次无效,仍是 Noto Sans)。改为复用 fontVarFor() 产出 inline
font-family,class 仅作语义
- 书架与瞬间各自独立配置;默认值取「改造前外观」(均 font-sans)
验证: 构建 exit 0;content-lint 52 页 0/0/0;E2E 56/56;
实测(只改 books 样式)书架 computed = 16px / rgb(51,52,58) / Ma Shan Zheng,
瞬间保持 13px / ink-4 / Noto Sans(两页互不影响);
op-gitea 侧另测:仅改文本、整段删 style(与基线逐字段一致)、非法值
(size:40/color:red/font 乱写)全部安全回落
Spec: 2026-11-03_blog-5j-content-refine (T3)
Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
7e0167a8bb
commit
58baad5a7b
3 files changed
+31
-7
No files matched your search
@@ -5,7 +5,7 @@ import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import MomentComments from '../MomentComments.astro';
|
||||
import ViewMeta from '../geek/ViewMeta.astro';
|
||||
import { t } from '../../i18n/ui';
|
||||
import { renderRich } from '../../lib/site-content';
|
||||
import { pageNote, renderRich } from '../../lib/site-content';
|
||||
import type { Locale } from '../../lib/locale';
|
||||
|
||||
// /en/ 侧由 T4 薄页传 locale='en';zh 路由无人传参,默认 zh 零回归
|
||||
@@ -13,6 +13,8 @@ interface Props {
|
||||
locale?: Locale;
|
||||
}
|
||||
const { locale = 'zh' } = Astro.props;
|
||||
// 标题下说明:文字与样式都可后台改(白名单校验,非法值回落)
|
||||
const note = await pageNote('moments', locale);
|
||||
|
||||
const moments = (await getCollection('moments')).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
@@ -32,7 +34,8 @@ const iso = (d: Date) => d.toISOString();
|
||||
|
||||
<BaseLayout title={`${t('moments_title', locale)} · wait4x`}>
|
||||
<h1 class="page-title">{t('moments_title', locale)}</h1>
|
||||
<p class="page-note">{t('moments_note', locale)}</p>
|
||||
<!-- 标题下说明:文案/字号/颜色/字体均由后台「页面文案 → 页面说明」控制(site-content.pageNote) -->
|
||||
<p class:list={['page-note', note.className]} style={note.style} set:html={note.html} />
|
||||
<!-- 整页计数(Phase 5h T4):这是本页唯一的计数点(page 模式);
|
||||
每条瞬间卡片底部的徽标是 readonly,读者开评论不会虚增浏览数 -->
|
||||
<ViewMeta class="mom-page-meta" pageKey={locale === 'en' ? '/en/moments/' : '/moments/'} {locale} variant="chip" />
|
||||
|
||||
Reference in new issue
Block a user