Skip to content

Commit 71c98b4

Browse files
committed
feat: add RSS
1 parent 24c5fc9 commit 71c98b4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/pages/rss.xml.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
import rss, { pagesGlobToRssItems } from "@astrojs/rss";
1+
import rss from "@astrojs/rss";
22

33
export async function GET(context) {
4+
const postImportResult = import.meta.glob("../content/posts/**/*.mdx", {
5+
eager: true,
6+
});
7+
const posts = Object.values(postImportResult);
8+
49
return rss({
510
title: "Astro Learner | Blog",
611
description: "My journey learning Astro",
712
site: context.site,
8-
items: await pagesGlobToRssItems(
9-
import.meta.glob("../content/posts/**/*.mdx")
10-
),
11-
customData: `<language>en-us</language>`,
13+
items: posts.map((post) => ({
14+
title: post.frontmatter.title,
15+
description: post.frontmatter.spoiler,
16+
link: post.frontmatter.href,
17+
pubDate: new Date(post.frontmatter.date),
18+
})),
1219
});
1320
}

0 commit comments

Comments
 (0)