This commit is contained in:
2025-05-19 01:16:25 -06:00
parent 1465b7dc24
commit e0da76f503
6 changed files with 301 additions and 27 deletions

19
src/pages/rss.xml.js Normal file
View File

@@ -0,0 +1,19 @@
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>`,
});
}