From af781cc5675d0a197eb19cb750533334c87534a6 Mon Sep 17 00:00:00 2001 From: Cassidy Williams <1454517+cassidoo@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:16:14 -0600 Subject: [PATCH] Blindly hope that sorting the RSS feed differently works --- src/pages/rss.xml.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index 96ebd88..dd68b7a 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -1,7 +1,13 @@ import rss from "@astrojs/rss"; import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; -const posts = Object.values(import.meta.glob("../posts/*.md", { eager: true })); +let posts = Object.values(import.meta.glob("../posts/*.md", { eager: true })); + +posts = posts.sort( + (a, b) => + new Date(b.frontmatter.updated || b.frontmatter.added).valueOf() - + new Date(a.frontmatter.updated || a.frontmatter.added).valueOf() +); export const get = () => rss({ @@ -13,7 +19,11 @@ export const get = () => link: `/post/${post.frontmatter.slug}`, title: post.frontmatter.title, pubDate: post.frontmatter.added, + description: post.frontmatter.description, content: post.compiledContent(), + customData: { + updated: post.frontmatter?.updated, + }, }; }), });