summaryrefslogtreecommitdiff
path: root/src/pages/rss.xml.js
blob: 1fa2b184bbaff477ce599c5f0eb444029fa2dea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { getCollection } from 'astro:content';
import rss from '@astrojs/rss';
import { SITE_DESCRIPTION, SITE_TITLE } from '../consts';

export async function GET(context) {
	const posts = await getCollection('blog');
	return rss({
		title: SITE_TITLE,
		description: SITE_DESCRIPTION,
		site: context.site,
		items: posts.map((post) => ({
			...post.data,
			link: `/blog/${post.id}/`,
		})),
	});
}