Migrate to Astro 5

This commit is contained in:
Bad Manners 2024-12-03 19:09:09 -03:00
parent 5d701069e9
commit bb1e533a00
No known key found for this signature in database
GPG key ID: 8C88292CCB075609
129 changed files with 1408 additions and 1448 deletions

View file

@ -1,6 +1,6 @@
import rss from "@astrojs/rss";
import type { APIRoute } from "astro";
import { getCollection } from "astro:content";
import { getCollection, render } from "astro:content";
import { blogFeedItem, type EntryWithPubDate } from "@utils/feed";
const MAX_ITEMS = 8;
@ -22,7 +22,7 @@ export const GET: APIRoute = async ({ site }) => {
xmlns: { atom: "http://www.w3.org/2005/Atom" },
customData: `<link href="${new URL("blog", site)}" rel="alternate" type="text/html" /><atom:link href="${new URL("blog/feed.xml", site)}" rel="self" type="application/rss+xml" />`,
items: await Promise.all(
posts.map(async ({ data, slug, render }) => blogFeedItem(site, data, slug, (await render()).Content)),
posts.map(async (post) => blogFeedItem(site, post.data, post.id, (await render(post)).Content)),
),
});
};