diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index ba13516..8cbaa2d 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -1,11 +1,17 @@ import rss, { pagesGlobToRssItems } from "@astrojs/rss"; +import { getCollection } from "astro:content"; export async function GET(context) { return rss({ title: "Astro Learner | Blog", description: "My journey learning Astro", site: context.site, - items: await pagesGlobToRssItems(import.meta.glob("./**/*.md")), + items: (await getCollection("blog")).map((post) => ({ + title: post.data.title, + pubDate: post.data.pubDate, + description: post.data.description, + link: `/blog/${post.id}`, + })), customData: `en-us`, }); }