a494c80a76
- Split all page.tsx files into server wrapper (metadata export) + client.tsx (Apollo/interactive) - Add robots.ts and sitemap.ts (tournaments, teams, players) - Add metadataBase, OpenGraph and Twitter card metadata to root layout - Replace hardcoded worldcup.pivoine.art with NEXT_PUBLIC_SITE_URL env var (sitemap/robots) and relative paths (page metadata, resolved by Next.js against metadataBase) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
986 B
TypeScript
27 lines
986 B
TypeScript
import type { Metadata } from 'next'
|
|
import { db } from '@/lib/db'
|
|
import { tournaments } from '@/lib/db/schema'
|
|
import { eq } from 'drizzle-orm'
|
|
import { TournamentClient } from './client'
|
|
|
|
type Props = { params: Promise<{ year: string }> }
|
|
|
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
const { year: yearStr } = await params
|
|
const year = parseInt(yearStr)
|
|
const [t] = await db.select().from(tournaments).where(eq(tournaments.year, year)).limit(1)
|
|
const title = `${year} FIFA World Cup`
|
|
const description = t
|
|
? `${year} FIFA World Cup hosted by ${t.host}.${t.winner ? ` Winner: ${t.winner}.` : ''} Matches, scores, group standings and statistics.`
|
|
: `${year} FIFA World Cup — matches, scores and statistics.`
|
|
return {
|
|
title,
|
|
description,
|
|
openGraph: { title, description, url: `/tournaments/${year}` },
|
|
}
|
|
}
|
|
|
|
export default function TournamentPage({ params }: Props) {
|
|
return <TournamentClient params={params} />
|
|
}
|