import type { APIRoute } from 'astro';
import { getCollection } from 'astro:content';
export const GET: APIRoute = async ({ site }) => {
const updates = await getCollection('updates');
const sorted = updates.sort(
(a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime()
);
const base = 'https://bifrost.fenja.ai';
const items = sorted.map((u) => {
const url = `${base}/updates/${u.slug}`;
const date = new Date(u.data.date).toUTCString();
return `
-
${url}
${url}
${date}
${u.data.author}
`;
});
const xml = `
Project Bifrost — Updates
Progress notes from Fenja AI during the Bifrost pilot.
${base}/updates
en
${items.join('')}
`;
return new Response(xml, {
headers: { 'Content-Type': 'application/rss+xml; charset=utf-8' },
});
};