From 86e8009f3417e990a1811081a50360c52e47d3a7 Mon Sep 17 00:00:00 2001 From: wait4xx Date: Sun, 25 Oct 2026 11:23:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(polish):=20en=20=E9=A6=96=E9=A1=B5=E6=8C=89?= =?UTF-8?q?=20zh=20=E5=85=A8=E7=BB=93=E6=9E=84=E9=87=8D=E5=86=99=E2=80=94?= =?UTF-8?q?=E2=80=94PostList=20locale=20=E5=8C=96=E4=B8=8E=E7=89=88?= =?UTF-8?q?=E9=9D=A2=E5=B9=B3=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PostList 组件加 locale prop(轨道标签走字典、en 链接 /en/ 前缀) - en/index 镜像 zh 结构:名片区三图标(GitHub/RSS/邮箱)+ 文章列表 + 最新影像(latest-head space-between + 4 列瓷砖网格,修复上轮 粘连与整宽竖排两处硬伤)+ 热力图 + 项目墙,区块顺序与 zh 一致 - 闭环截图:zh 滚动至热力图锚点(修复验证缺口) 验证: pnpm astro build 21 页 exit 0;node tests/e2e.mjs 30/30 PASS Spec: 2026-10-25_fix-site-polish Co-authored-by: GLM-5.3 --- src/components/PostList.astro | 17 ++- src/pages/en/index.astro | 193 +++++++++++++++++++++++----------- 2 files changed, 144 insertions(+), 66 deletions(-) diff --git a/src/components/PostList.astro b/src/components/PostList.astro index af3f718..8a05c60 100644 --- a/src/components/PostList.astro +++ b/src/components/PostList.astro @@ -2,13 +2,22 @@ // 年份分组 + 轨道分节的文章列表(首页与 /archives/ 共用) // 轨道标签单一事实源:content.config 的 POST_TRACKS,此处不另立词表 import type { CollectionEntry } from 'astro:content'; -import { POST_TRACKS, trackOf, type PostCategory } from '../content.config'; +import { POST_TRACKS, type PostCategory } from '../content.config'; +import { t } from '../i18n/ui'; interface Props { /** 调用方已完成 draft 过滤与 pubDate 倒序 */ posts: CollectionEntry<'posts'>[]; + locale?: 'zh' | 'en'; } -const { posts } = Astro.props; +const { posts, locale = 'zh' } = Astro.props; +// 轨道标签走字典(en 首页复用本组件时的双语位);zh 保持原词表语义 +const TRACK_LABEL: Record = { + reading: t('category_reading', locale), + tech: t('category_tech', locale), + photo: t('category_photo', locale), +}; +const hrefOf = (id: string) => (locale === 'en' ? `/en/archives/${id}/` : `/archives/${id}/`); const byYear = new Map[]>(); for (const post of posts) { @@ -30,11 +39,11 @@ const mmdd = (d: Date) => if (rows.length === 0) return null; return (
-

{trackOf(cat)}

+

{TRACK_LABEL[cat]}