summaryrefslogtreecommitdiff
path: root/src/pages/micro/rss.xml.ts
blob: 73113190e30bf2820e428f6c625d5e40de7c05e6 (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 micro = await getCollection("note");

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