Files
supabase/apps/www/pages/api/changelog-discussion/[number].ts
T
Francesco Sansalvadore 580598f0e8 feat(www): update changelog layout, rss and md files (#45219)
- Update Changelog [index page
layout](https://zone-www-dot-com-git-feat-changelog-update-supabase.vercel.app/changelog):
  - with full timeline
  - filterable based on text search and tags
- New Changelog [detail
pages](https://zone-www-dot-com-git-feat-changelog-update-supabase.vercel.app/changelog/45071)
  - all added to www_sitemap
- Changelog [RSS
Feed](https://zone-www-dot-com-git-feat-changelog-update-supabase.vercel.app/changelog/45071)
+ llm-friendly
[/changelog.md](https://zone-www-dot-com-git-feat-changelog-update-supabase.vercel.app/changelog.md)
- and llm-friendly changelog detail md files:
https://zone-www-dot-com-git-feat-changelog-update-supabase.vercel.app/changelog/45071.md

## Before
<img width="1604" height="1094" alt="Screenshot 2026-04-27 at 17 07 55"
src="https://github.com/user-attachments/assets/eac52f14-e447-4f64-8d50-a8e287ccf989"
/>

## After
<img width="1247" height="849" alt="changelog-index"
src="https://github.com/user-attachments/assets/69b7bae1-63eb-4a4d-a065-7541ed9738b4"
/>

### Detail page
<img width="1695" height="1101" alt="Screenshot 2026-04-27 at 18 27 27"
src="https://github.com/user-attachments/assets/accd4be8-d665-43ed-bcb7-0e6baf537762"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **New Features**
* Redesigned changelog page with full-text search and product tag
filtering
  * Individual pages for each changelog entry with dedicated URLs
  * Added RSS feeds for changelog updates and product-specific feeds
  * Copy changelog entries as markdown with one click
  * Direct sharing integration with ChatGPT and Claude

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-04-29 12:31:30 +02:00

53 lines
1.5 KiB
TypeScript

import {
CHANGELOG_CATEGORY_ID,
createChangelogOctokit,
fetchChangelogDiscussionByNumber,
} from '~/lib/changelog-github'
import { discussionDisplayDate } from '~/lib/changelog.utils'
import { mdxSerialize } from '~/lib/mdx/mdxSerialize'
import type { NextApiRequest, NextApiResponse } from 'next'
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== 'GET') {
res.setHeader('Allow', 'GET')
return res.status(405).json({ error: 'Method not allowed' })
}
const raw = req.query.number
const numStr = Array.isArray(raw) ? raw[0] : raw
const number = Number(numStr)
if (!Number.isFinite(number)) {
return res.status(400).json({ error: 'Invalid discussion number' })
}
try {
const octokit = createChangelogOctokit()
const discussion = await fetchChangelogDiscussionByNumber(
octokit,
'supabase',
'supabase',
number
)
if (!discussion || discussion.category?.id !== CHANGELOG_CATEGORY_ID) {
return res.status(404).json({ error: 'Not found' })
}
const source = await mdxSerialize(discussion.body)
const created_at = discussionDisplayDate({
title: discussion.title,
createdAt: discussion.createdAt,
})
res.setHeader('Cache-Control', 'public, max-age=900, stale-while-revalidate=900')
return res.status(200).json({
title: discussion.title,
url: discussion.url,
created_at,
source,
})
} catch (e) {
console.error(e)
return res.status(500).json({ error: 'Failed to load discussion' })
}
}