blob: 41b0d4a6f749a2f4f68adee4aea1939e968d966e [file] [log] [blame]
Samuel Shuert86826b82024-04-27 16:14:20 -04001import rss from '@astrojs/rss';
2import { getCollection } from 'astro:content';
3import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
4
5export async function GET(context) {
Samuel Shuert21af95a2024-04-30 17:49:11 -04006 const posts = await getCollection('post');
Samuel Shuert86826b82024-04-27 16:14:20 -04007 return rss({
8 title: SITE_TITLE,
9 description: SITE_DESCRIPTION,
10 site: context.site,
11 items: posts.map((post) => ({
12 ...post.data,
Samuel Shuert21af95a2024-04-30 17:49:11 -040013 link: `/post/${post.slug}/`,
Samuel Shuert86826b82024-04-27 16:14:20 -040014 })),
15 });
16}