Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions app/api/changelog-rss.xml/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { getChangelogIndexItems } from "@/lib/changelog-index";

export async function GET() {
try {
const items = getChangelogIndexItems();
const baseUrl =
process.env.NEXT_PUBLIC_BASE_URL ?? "https://langfuse.com";

const rssItems = items
.map((item) => {
const title = item.frontMatter?.title ?? "Untitled";
const description = item.frontMatter?.description ?? "";
const date = item.frontMatter?.date
? new Date(item.frontMatter.date).toUTCString()
: new Date().toUTCString();
const url = `${baseUrl}${item.route}`;

return `
<item>
<title><![CDATA[${title}]]></title>
<link>${url}</link>
<guid>${url}</guid>
<pubDate>${date}</pubDate>
<description><![CDATA[${description}]]></description>
</item>`;
})
.join("");

const feed = `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Langfuse Changelog</title>
<link>${baseUrl}/changelog</link>
<atom:link href="${baseUrl}/api/changelog-rss.xml" rel="self" type="application/rss+xml"/>
<description>Latest updates from Langfuse</description>
<language>en-us</language>
${rssItems}
</channel>
</rss>`;

return new Response(feed, {
headers: {
"Content-Type": "application/xml; charset=utf-8",
"Cache-Control": "public, max-age=3600, s-maxage=3600",
},
});
} catch (err) {
console.error("RSS generation failed:", err);
return new Response(
JSON.stringify({ error: "Failed to generate RSS feed" }),
{
status: 500,
headers: { "Content-Type": "application/json" },
}
);
}
}
17 changes: 15 additions & 2 deletions app/changelog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { TextHighlight } from "@/components/ui/text-highlight";
import { Link } from "@/components/ui/link";
import { Heading } from "@/components/ui/heading";
import { Text } from "@/components/ui/text";
import { Rss } from "lucide-react";
import { Button } from "@/components/ui/button";

type PageProps = {
searchParams: Promise<{ page?: string }>;
Expand All @@ -28,7 +30,6 @@ export async function generateMetadata({
);
const currentPage = parseChangelogPageParam(sp.page, totalPages);
const canonical = changelogPageHref(currentPage, totalPages) ?? "/changelog";

return {
title: currentPage > 1 ? `Changelog (page ${currentPage})` : "Changelog",
description:
Expand Down Expand Up @@ -60,7 +61,6 @@ export default async function ChangelogIndexPage({ searchParams }: PageProps) {
sliceStart,
sliceStart + CHANGELOG_ITEMS_PER_PAGE,
);

return (
<ContentColumns footerClassName="md:max-w-none xl:max-w-none px-6 sm:px-6 md:px-6">
<div className="mx-auto w-full px-6 py-8">
Expand All @@ -75,6 +75,19 @@ export default async function ChangelogIndexPage({ searchParams }: PageProps) {
</Link>{" "}
to see what&apos;s next.
</Text>
<div>
<Button
asChild
variant="secondary"
size="small"
className="inline-flex w-auto items-center gap-2"
>
<Link href="/api/changelog-rss.xml" target="_blank">
<Rss className="w-4 h-4" />
<span>RSS Feed</span>
</Link>
</Button>
</div>
Comment thread
GANESH-NADKARNI marked this conversation as resolved.
</div>
<div className="mb-8">
<ProductUpdateSignup source="changelog" />
Expand Down