import rss from '@astrojs/rss';
import { getAllPosts } from '@/lib/posts';

export function GET(context) {
  const posts = getAllPosts();

  return rss({
    title: "Bi's Blog",
    description: 'Personal blog by biss.',
    site: context.site,
    items: posts.map((post) => ({
      title: post.title,
      pubDate: post.date,
      description: post.summary,
      link: post.href,
    })),
  });
}
