Skip to content

Commit 9cda1ab

Browse files
committed
sort rss by date
1 parent 6e0f0a5 commit 9cda1ab

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/pages/rss.xml.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ export async function GET(context) {
55
import.meta.glob('./blog/*.{md,mdx}')
66
);
77

8-
console.log(originalItems)
98

10-
const itemsWithAuthor = originalItems.map((item) => ({
11-
...item,
12-
author: 'Andrew Moses',
13-
}));
9+
const itemsWithAuthor = originalItems
10+
.map((item) => ({
11+
...item,
12+
author: 'Andrew Moses',
13+
}))
14+
.sort(
15+
(a, b) =>
16+
new Date(b.pubDate) - new Date(a.pubDate)
17+
);
1418

1519
return rss({
1620
title: 'Andrew Moses',

0 commit comments

Comments
 (0)