fix(polish): en 首页按 zh 全结构重写——PostList locale 化与版面平权

- 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
This commit is contained in:
wait4xandGLM-5.3 committed 2026-10-25 11:23:30 +08:00
1 parent ebafa415b2
commit 86e8009f34
2 files changed
+144 -66

No files matched your search

+13 -4
View File
@@ -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<PostCategory, string> = {
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<number, CollectionEntry<'posts'>[]>();
for (const post of posts) {
@@ -30,11 +39,11 @@ const mmdd = (d: Date) =>
if (rows.length === 0) return null;
return (
<div class="track-block">
<h3 class="track">{trackOf(cat)}</h3>
<h3 class="track">{TRACK_LABEL[cat]}</h3>
<ul>
{rows.map((post) => (
<li>
<a class="row tap" href={`/archives/${post.id}/`}>
<a class="row tap" href={hrefOf(post.id)}>
{cat === 'reading' && (
<i
class="emo"