chore(spec): 归档 fix-site-polish——四缺陷+双轨验证六任务收敛
Spec: 2026-10-25_fix-site-polish Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
86e8009f34
commit
59b7baae51
8 files changed
+221
-92
No files matched your search
@@ -9,8 +9,10 @@ interface Props {
|
||||
/** 调用方已完成 draft 过滤与 pubDate 倒序 */
|
||||
posts: CollectionEntry<'posts'>[];
|
||||
locale?: 'zh' | 'en';
|
||||
/** slug → 译题(en 列表显示英文标题,视觉复核范围外观察) */
|
||||
titleOverrides?: Record<string, string>;
|
||||
}
|
||||
const { posts, locale = 'zh' } = Astro.props;
|
||||
const { posts, locale = 'zh', titleOverrides } = Astro.props;
|
||||
// 轨道标签走字典(en 首页复用本组件时的双语位);zh 保持原词表语义
|
||||
const TRACK_LABEL: Record<PostCategory, string> = {
|
||||
reading: t('category_reading', locale),
|
||||
@@ -52,7 +54,7 @@ const mmdd = (d: Date) =>
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)}
|
||||
<span class="row-title">{post.data.title}</span>
|
||||
<span class="row-title">{titleOverrides?.[post.id] ?? post.data.title}</span>
|
||||
{cat !== 'reading' &&
|
||||
post.data.tags.map((tag) => <code class="tag">{`#${tag}`}</code>)}
|
||||
<time class="row-date" datetime={post.data.pubDate.toISOString()}>
|
||||
|
||||
@@ -12,6 +12,10 @@ import { t } from '../../i18n/ui';
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
);
|
||||
// 列表标题吃 postsEn 译题(缺译回退 zh,与 /en/archives 同策略)
|
||||
const enTitle = Object.fromEntries(
|
||||
(await getCollection('postsEn')).map((e) => [e.id, e.data.title]),
|
||||
);
|
||||
const photos = (await getCollection('photos')).slice(0, 4);
|
||||
---
|
||||
|
||||
@@ -65,7 +69,7 @@ const photos = (await getCollection('photos')).slice(0, 4);
|
||||
</div>
|
||||
</IdCard>
|
||||
|
||||
<PostList {posts} locale="en" />
|
||||
<PostList {posts} locale="en" titleOverrides={enTitle} />
|
||||
|
||||
<section class="latest" aria-label={t('latest_photos', 'en')}>
|
||||
<div class="latest-head">
|
||||
|
||||
Reference in new issue
Block a user