rss
This commit is contained in:
parent
a6e43f0640
commit
efbb1ea558
1 changed files with 20 additions and 0 deletions
20
astro/src/rss.xml.js
Executable file
20
astro/src/rss.xml.js
Executable file
|
@ -0,0 +1,20 @@
|
|||
import rss from "@astrojs/rss";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export async function GET(context) {
|
||||
const blog = await getCollection("blog");
|
||||
return rss({
|
||||
title: "nelle",
|
||||
description: "personal site of nelle",
|
||||
site: context.site,
|
||||
items: blog.map((post) => ({
|
||||
title: post.data.title,
|
||||
pubDate: post.data.pubDate,
|
||||
description: post.data.description,
|
||||
customData: post.data.customData,
|
||||
// Compute RSS link from post `slug`
|
||||
// This example assumes all posts are rendered as `/blog/[slug]` routes
|
||||
link: `/blog/${post.slug}/`,
|
||||
})),
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue