diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-09-08 18:01:35 -0700 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-09-08 18:01:35 -0700 |
| commit | 4c04b2b740399e7b810c3a7c2f098ca3301268cd (patch) | |
| tree | 52b55445a2843b6626c14ce9283d1527b8941682 /src | |
| parent | 53af37a9adb8194467656f173af0f8bb98bb197e (diff) | |
sort RSS feed by latest posts first
Diffstat (limited to 'src')
| -rw-r--r-- | src/pages/rss.xml.js | 3 |
1 files changed, 2 insertions, 1 deletions
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 |
