summaryrefslogtreecommitdiff
path: root/src/pages/notes/rss.xml.ts
blob: 0f1f945d56bb4c1639759782bb158953acbfa080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { getCollection } from "astro:content";
import { siteConfig } from "@/site.config";
import rss from "@astrojs/rss";

export const GET = async () => {
	const notes = await getCollection("note");

	return rss({
		title: siteConfig.title,
		description: siteConfig.description,
		site: import.meta.env.SITE,
		items: notes.map((note) => ({
			title: note.data.title,
			pubDate: note.data.publishDate,
			link: `notes/${note.id}/`,
		})),
	});
};