src/pages/rss.xml.ts 470 B raw
1
import rss from "@astrojs/rss";
2
import { getCollection } from "astro:content";
3
import siteMeta from "@/site-config";
4
5
export const get = async () => {
6
	const posts = await getCollection("post");
7
8
	return rss({
9
		title: siteMeta.title,
10
		description: siteMeta.description,
11
		site: import.meta.env.SITE,
12
		items: posts.map((post) => ({
13
			title: post.data.title,
14
			description: post.data.description,
15
			pubDate: post.data.publishDate,
16
			link: post.slug,
17
		})),
18
	});
19
};