rss.xml.js 404 B

12345678910111213141516
  1. import rss from '@astrojs/rss';
  2. import { getCollection } from 'astro:content';
  3. import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
  4. export async function GET(context) {
  5. const posts = await getCollection('blog');
  6. return rss({
  7. title: SITE_TITLE,
  8. description: SITE_DESCRIPTION,
  9. site: context.site,
  10. items: posts.map((post) => ({
  11. ...post.data,
  12. link: `/blog/${post.slug}/`,
  13. })),
  14. });
  15. }