diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index 6241da7..417908b 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -3,7 +3,11 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; let posts = Object.values(import.meta.glob("../posts/*.md", { eager: true })); -console.log(posts); +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({ @@ -17,9 +21,9 @@ export const get = () => pubDate: post.frontmatter.added, description: post.frontmatter.description, content: post.compiledContent(), - customData: { - updated: post.frontmatter?.updated, - }, + customData: `${ + post.frontmatter.updated ? post.frontmatter.updated : "" + }`, }; }), });