19 lines
531 B
JavaScript
19 lines
531 B
JavaScript
import rss from '@astrojs/rss';
|
|
import { getCollection } from 'astro:content';
|
|
|
|
export async function GET(context) {
|
|
const posts = await getCollection('posts');
|
|
|
|
return rss({
|
|
title: 'Atridad Lahiji',
|
|
description: 'Recent posts from Atridad Lahiji',
|
|
site: context.site,
|
|
items: posts.map((post) => ({
|
|
title: post.data.title,
|
|
pubDate: post.data.pubDate,
|
|
description: post.data.description || '',
|
|
link: `/post/${post.slug}/`,
|
|
})),
|
|
customData: `<language>en-us</language>`,
|
|
});
|
|
}
|