diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index e9d77fb2d..368eb0ea8 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -1,19 +1,22 @@ import rss from "@astrojs/rss"; import { getCollection } from "astro:content"; -import { SITE } from "@config"; +import getSortedPosts from "@utils/getSortedPosts"; import slugify from "@utils/slugify"; +import { SITE } from "@config"; export async function get() { - const posts = await getCollection("blog", ({ data }) => !data.draft); + const posts = await getCollection("blog"); + const sortedPosts = getSortedPosts(posts); return rss({ title: SITE.title, description: SITE.desc, site: SITE.website, - items: posts.map(({ data }) => ({ - link: `posts/${slugify(data)}`, - title: data.title, - description: data.description, - pubDate: new Date(data.pubDatetime), - })), + items: sortedPosts + .map(({ data }) => ({ + link: `posts/${slugify(data)}`, + title: data.title, + description: data.description, + pubDate: new Date(data.pubDatetime), + })), }); }