Fix listing sort order: order by pubDate, matching the date displayed
Deploy / build (push) Successful in 36s
Deploy / build (push) Successful in 36s
Listings render `pubDate` but sorted by `updatedDate ?? pubDate`, so any
post carrying both dates sorted by a date it never displayed. After the
backdate commit the two diverged by years and the list read out of order
("January 7, 2026" above "September 13, 2026", "March 11, 2026" below
"December 10, 2025").
Replace `sortByUpdated` with `sortForListing`, which orders by `pubDate`
and uses `updatedDate` only as a tiebreak. This matches the RSS feed,
which already sorted by `pubDate`.
Verified all three listings (EN, EN homepage, ZH) are monotonically
non-increasing across the full 2024-09 -> 2026-09 span.
This commit is contained in:
1 parent
ae2ccedaad
commit
2df67b6c50
6 files changed
+34
-17
No files matched your search
@@ -4,9 +4,9 @@ import PostList from '../components/PostList.astro';
|
||||
import { getCollection } from 'astro:content';
|
||||
import { isEn } from '../lib/lang';
|
||||
import { SITE } from '../config';
|
||||
import { sortByUpdated } from '../lib/sort';
|
||||
import { sortForListing } from '../lib/sort';
|
||||
|
||||
const posts = sortByUpdated(await getCollection('posts', isEn));
|
||||
const posts = sortForListing(await getCollection('posts', isEn));
|
||||
---
|
||||
|
||||
<BaseLayout title={SITE.title} description={SITE.description} altLocaleUrl={`${SITE.url}/zh/`}>
|
||||
|
||||
Reference in new issue
Block a user