diff --git a/src/components/global/footer.astro b/src/components/global/footer.astro index a4e2354b..e00198b3 100644 --- a/src/components/global/footer.astro +++ b/src/components/global/footer.astro @@ -39,7 +39,8 @@ Discord YouTube X - RSS + Posts RSS + Newsletters RSS diff --git a/src/components/global/head.astro b/src/components/global/head.astro index 21714792..6f7862ce 100644 --- a/src/components/global/head.astro +++ b/src/components/global/head.astro @@ -49,3 +49,10 @@ const defaultDescription = title="Ladybird Browser Posts" href={new URL("posts.rss", Astro.site)} /> + + diff --git a/src/pages/newsletters.rss.ts b/src/pages/newsletters.rss.ts new file mode 100644 index 00000000..de4c393b --- /dev/null +++ b/src/pages/newsletters.rss.ts @@ -0,0 +1,21 @@ +import rss from "@astrojs/rss"; +import { getCollection } from "astro:content"; +import type { APIContext } from "astro"; + +export async function GET(context: APIContext) { + const posts = await getCollection("newsletters"); + return rss({ + title: "Ladybird Browser Newsletters", + description: "Ladybird is a brand-new browser & web engine", + site: context.site!, + items: posts + .filter((newsletter) => !newsletter.data.draft) + .map((newsletter) => ({ + title: newsletter.data.title, + description: newsletter.data.description, + pubDate: newsletter.data.date, + link: `/newsletter/${newsletter.slug}`, + })), + trailingSlash: false, + }); +}