We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8586fab commit 8780e3aCopy full SHA for 8780e3a
src/pages/rss.xml.js
@@ -1,11 +1,18 @@
1
-import rss, { pagesGlobToRssItems } from "@astrojs/rss";
+import rss from "@astrojs/rss";
2
+import { getCollection } from 'astro:content';
3
4
export async function GET(context) {
5
+ const blog = await getCollection('blog');
6
return rss({
7
title: "Astro Learner | Blog",
8
description: "My journey learning Astro",
9
site: context.site,
- items: await pagesGlobToRssItems(import.meta.glob("./**/*.md")),
10
+ items: blog.map((post) => ({
11
+ title: post.data.title,
12
+ pubDate: post.data.publishDate,
13
+ description: post.data.description,
14
+ link: `/posts/${post.data.slug}/`,
15
+ })),
16
customData: `<language>en-us</language>`,
17
});
18
}
0 commit comments