import rss from '@astrojs/rss'; import { getCollection } from 'astro:content'; import type { APIContext } from 'astro'; export async function GET(context: APIContext) { const posts = (await getCollection('blog')) .filter((post) => !post.data.draft) .sort((a, b) => b.data.date.getTime() - a.data.date.getTime()); return rss({ title: 'Plannotator Blog', description: 'News and updates from Plannotator', site: context.site!, items: posts.map((post) => ({ title: post.data.title, description: post.data.description, pubDate: post.data.date, link: `/blog/${post.id}/`, })), }); }