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) { |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 6 | const posts = await getCollection('post'); |
Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 7 | return rss({ |
| 8 | title: SITE_TITLE, |
| 9 | description: SITE_DESCRIPTION, |
| 10 | site: context.site, |
| 11 | items: posts.map((post) => ({ |
| 12 | ...post.data, |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 13 | link: `/post/${post.slug}/`, |
Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 14 | })), |
| 15 | }); |
| 16 | } |