| 1 | import { allChangelogs } from 'content-collections' |
| 2 | import { format } |
| 3 | import { ArrowLeft } |
| 4 | import type { Metadata |
| 5 | import Link from 'next/link |
| 6 | import { notFound } |
| 7 | import { buttonVariants } |
| 8 | import { createMetadata } |
| 9 | |
| 10 | export function generateStaticParams() |
| 11 | return allChangelogs.map |
| 12 | } |
| 13 | |
| 14 | export async function generateMetadata |
| 15 | params, |
| 16 | }: PageProps< |
| 17 | const { slug |
| 18 | const entry = |
| 19 | if (!entry) |
| 20 | return createMetadata({ |
| 21 | } |
| 22 | const ogUrl = |
| 23 | return createMetadata({ |
| 24 | title: `${entry. |
| 25 | description: entry.description |
| 26 | openGraph: { images: ogUrl |
| 27 | twitter: { images: ogUrl |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | export default async function |
| 32 | params, |
| 33 | }: PageProps< |
| 34 | const { slug |
| 35 | const entry = |
| 36 | if (!entry) |
| 37 | notFound() |
| 38 | } |
| 39 | |
| 40 | return ( |
| 41 | <main className='mx-auto max-w-3xl px-6 py-16 |
| 42 | <Link |
| 43 | className={buttonVariants({ |
| 44 | variant: 'ghost', |
| 45 | className: 'text-muted-foreground', |
| 46 | })} |
| 47 | href='/changelogs' |
| 48 | > |
| 49 | <ArrowLeft className=' |
| 50 | </Link> |
| 51 | |
| 52 | <header className='mt-6 mb-10 |
| 53 | <div className='mb-3 flex items-center gap-3 text-muted-foreground text-sm |
| 54 | <time dateTime={entry |
| 55 | {format(new Date |
| 56 | </time> |
| 57 | {entry.version ? |
| 58 | <span className='rounded-full border border-border px-2 py-0.5 font-mono text-xs |
| 59 | v{entry.version} |
| 60 | </span> |
| 61 | ) : null} |
| 62 | </div> |
| 63 | <h1 className='font-bold text-4xl tracking-tight |
| 64 | <p className='mt-3 text-lg text-muted-foreground |
| 65 | {entry.description} |
| 66 | </p> |
| 67 | </header> |
| 68 | |
| 69 | <article |
| 70 | className='prose prose-neutral dark:prose-invert max-w-none' |
| 71 | // biome-ignore lint/security/noDangerouslySetInnerHtml: trusted local markdown |
| 72 | dangerouslySetInnerHTML={{ __html: |
| 73 | /> |
| 74 | </main> |
| 75 | ) |
| 76 | } |