Skip to content

Commit 060a32d

Browse files
committed
add newsletter rss feed
1 parent e28db79 commit 060a32d

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

src/components/global/footer.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
<a href="https://discord.gg/nvfjVJ4Svh">Discord</a>
4040
<a href="https://www.youtube.com/@LadybirdBrowser">YouTube</a>
4141
<a href="https://x.com/ladybirdbrowser">X</a>
42-
<a href="https://ladybird.org/posts.rss">RSS</a>
42+
<a href="/posts.rss">Posts RSS</a>
43+
<a href="/newsletters.rss">Newsletters RSS</a>
4344
</div>
4445
</div>
4546
</div>

src/components/global/head.astro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,10 @@ const defaultDescription =
4949
title="Ladybird Browser Posts"
5050
href={new URL("posts.rss", Astro.site)}
5151
/>
52+
53+
<link
54+
rel="alternate"
55+
type="application/rss+xml"
56+
title="Ladybird Browser Newsletters"
57+
href={new URL("newsletters.rss", Astro.site)}
58+
/>

src/pages/newsletters.rss.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import rss from "@astrojs/rss";
2+
import { getCollection } from "astro:content";
3+
import type { APIContext } from "astro";
4+
5+
export async function GET(context: APIContext) {
6+
const posts = await getCollection("newsletters");
7+
return rss({
8+
title: "Ladybird Browser Newsletters",
9+
description: "Ladybird is a brand-new browser &amp; web engine",
10+
site: context.site!,
11+
items: posts
12+
.filter((newsletter) => !newsletter.data.draft)
13+
.map((newsletter) => ({
14+
title: newsletter.data.title,
15+
description: newsletter.data.description,
16+
pubDate: newsletter.data.date,
17+
link: `/newsletter/${newsletter.slug}`,
18+
})),
19+
trailingSlash: false,
20+
});
21+
}

0 commit comments

Comments
 (0)