From fc599520a300579e4adb11e9f485c2daf8f5ef37 Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Tue, 24 Mar 2026 20:09:42 +0200 Subject: [PATCH] update rss --- src/pages/rss.xml.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index fa16634..7c78543 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -1,11 +1,20 @@ -import rss, { pagesGlobToRssItems } from '@astrojs/rss'; +import rss from '@astrojs/rss'; +import { pagesGlobToRssItems } from '@astrojs/rss'; +import { getCollection } from 'astro:content'; export async function GET(context) { + const posts = await getCollection("blog"); return rss({ title: 'Astro Learner | Blog', description: 'My journey learning Astro', site: context.site, items: await pagesGlobToRssItems(import.meta.glob('./**/*.md')), + items: posts.map((post) => ({ + title: post.data.title, + pubDate: post.data.pubDate, + description: post.data.description, + link: `/posts/${post.id}/`, + })), customData: `en-us`, - }); + }) } \ No newline at end of file