aboutsummaryrefslogtreecommitdiff
path: root/src/pages/blog.xml.ts
blob: 44233b32aa0e6873db850a8f35fc0560d64124d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";

export async function GET(context: any) {
  const collection = await getCollection("blog");

  return rss({
    title: "Blog de Ariel Costas",
    description: "Artículos del blog de Ariel Costas",
    site: context.site,
    items: collection.map((post: any) => ({
      title: post.data.title,
      link: `${context.site}blog/${post.slug}`,
      description: post.data.metaDescription,
      pubDate: post.data.publishedAt,
    })),
  });
}