Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 1 | import rss from '@astrojs/rss'; |
2 | import { getCollection } from 'astro:content'; | ||||
3 | import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; | ||||
4 | |||||
5 | export async function GET(context) { | ||||
6 | const posts = await getCollection('blog'); | ||||
7 | return rss({ | ||||
8 | title: SITE_TITLE, | ||||
9 | description: SITE_DESCRIPTION, | ||||
10 | site: context.site, | ||||
11 | items: posts.map((post) => ({ | ||||
12 | ...post.data, | ||||
13 | link: `/blog/${post.slug}/`, | ||||
14 | })), | ||||
15 | }); | ||||
16 | } |