diff --git a/src/components/PostList.astro b/src/components/PostList.astro index 50f39f6..f808971 100644 --- a/src/components/PostList.astro +++ b/src/components/PostList.astro @@ -33,8 +33,13 @@ const TRACK_LABEL: Record = { }; const hrefOf = (id: string) => (locale === 'en' ? `/en/archives/${id}/` : `/archives/${id}/`); +// 置顶浮出分组流(2026-11-05 用户实测修复):置顶文章若留在分组流里, +// 它所在月会因「顺次建桶」被提前建到顶部,整月文章跟着上浮—— +// 所以置顶单独一节渲染在年/月分组之前,分组只对非置顶文章按自然时序建桶。 +const pinned = visible.filter((p) => p.data.pinned); +const flow = visible.filter((p) => !p.data.pinned); const byYear = new Map[]>(); -for (const post of visible) { +for (const post of flow) { const year = post.data.pubDate.getUTCFullYear(); const bucket = byYear.get(year); if (bucket) bucket.push(post); @@ -107,6 +112,37 @@ const byMonth = (list: CollectionEntry<'posts'>[]) => { ) : fold ? (
+ {pinned.length > 0 && ( +
+

+ {t('pinned_label', locale)} + · {pinned.length} {units} +

+