mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES/NO ## What kind of change does this PR introduce? Bug fix, feature, docs update, ... ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots.
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import type { Metadata } from 'next'
|
|
import { notFound } from 'next/navigation'
|
|
|
|
import GoPageRenderer from '@/components/Go/GoPageRenderer'
|
|
import { SITE_ORIGIN } from '@/lib/constants'
|
|
import { getAllGoSlugs, getGoPageBySlug } from '@/lib/go'
|
|
|
|
export const revalidate = 30
|
|
|
|
type Params = { slug: string }
|
|
|
|
export async function generateStaticParams() {
|
|
return getAllGoSlugs().map((slug) => ({ slug }))
|
|
}
|
|
|
|
export async function generateMetadata({ params }: { params: Promise<Params> }): Promise<Metadata> {
|
|
const { slug } = await params
|
|
const page = getGoPageBySlug(slug)
|
|
|
|
if (!page) {
|
|
return { title: 'Page Not Found' }
|
|
}
|
|
|
|
const { metadata } = page
|
|
|
|
return {
|
|
title: `${metadata.title} | Supabase`,
|
|
description: metadata.description,
|
|
openGraph: {
|
|
title: metadata.title,
|
|
description: metadata.description,
|
|
url: `${SITE_ORIGIN}/go/${page.slug}`,
|
|
images: metadata.ogImage ? [{ url: metadata.ogImage }] : undefined,
|
|
},
|
|
twitter: {
|
|
card: 'summary_large_image',
|
|
title: metadata.title,
|
|
description: metadata.description,
|
|
images: metadata.ogImage ? [metadata.ogImage] : undefined,
|
|
},
|
|
robots: metadata.noIndex ? { index: false, follow: false } : undefined,
|
|
}
|
|
}
|
|
|
|
export default async function GoPage({ params }: { params: Promise<Params> }) {
|
|
const { slug } = await params
|
|
const page = getGoPageBySlug(slug)
|
|
|
|
if (!page) {
|
|
notFound()
|
|
}
|
|
|
|
return <GoPageRenderer page={page} />
|
|
}
|