import type { APIContext } from "astro"; import { DEFAULT_DESCRIPTION, SITE_NAME, SITE_URL } from "~/lib/og"; /** * Minimal RSS 2.0 feed for stack.ashlr.ai. * * Sourced from the three launch posts in src/pages/launch/* rather than a * content collection — there's nothing else to feed yet and adding * @astrojs/rss + a collection for 3 posts isn't worth the build-time cost. * When we start publishing changelog entries or blog posts on a cadence, * swap this for a getCollection()-backed generator. */ interface Entry { title: string; slug: string; description: string; pubDate: string; // RFC 822 } const ENTRIES: Entry[] = [ { title: "Introducing Ashlr Stack", slug: "launch/blog", description: "A source launch overview of Stack workflows for supported project services.", pubDate: "Fri, 18 Apr 2026 00:00:00 +0000", }, { title: "Draft: Ashlr Stack on HN", slug: "launch/hn", description: "Draft discussion post; submission or publication is not established.", pubDate: "Fri, 18 Apr 2026 00:00:00 +0000", }, { title: "Draft: Ashlr Stack launch thread", slug: "launch/twitter", description: "Draft thread text; posting or customer acceptance is not established.", pubDate: "Fri, 18 Apr 2026 00:00:00 +0000", }, ]; function escapeXml(s: string): string { return s .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """); } export async function GET(_: APIContext): Promise { const items = ENTRIES.map((e) => { const link = `${SITE_URL}/${e.slug}/`; return ` ${escapeXml(e.title)} ${link} ${link} ${e.pubDate} ${escapeXml(e.description)} `; }).join(""); const xml = ` ${escapeXml(SITE_NAME)} ${SITE_URL} ${escapeXml(DEFAULT_DESCRIPTION)} en-us ${items} `; return new Response(xml, { status: 200, headers: { "Content-Type": "application/rss+xml; charset=utf-8", "Cache-Control": "public, max-age=600", }, }); }