Files
atridotdad/src/pages/rss.xml.js
2025-05-19 01:16:25 -06:00

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>`,
});
}