From 4c04b2b740399e7b810c3a7c2f098ca3301268cd Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Fri, 8 Sep 2023 18:01:35 -0700 Subject: sort RSS feed by latest posts first --- src/pages/rss.xml.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index 7d054b9..9041051 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -4,6 +4,7 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; export async function get(context) { const posts = await getCollection('blog'); + posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime()); return rss({ title: SITE_TITLE, description: SITE_DESCRIPTION, @@ -13,4 +14,4 @@ export async function get(context) { link: `/blog/${post.slug}/`, })), }); -} +} \ No newline at end of file -- cgit v1.2.3