import Image from "next/image"; import { notFound } from "next/navigation"; import type { Metadata } from "next"; import { Section } from "../../components/ui/Section"; import { SectionHeading } from "../../components/ui/SectionHeading"; import { ButtonLink } from "../../components/ui/ButtonLink"; import { Reveal } from "../../components/ui/Reveal"; import { GameHero } from "../../components/game/GameHero"; import { GamePillars } from "../../components/game/GamePillars"; import { CoopBand } from "../../components/game/CoopBand"; import { ScreenshotGallery } from "../../components/game/ScreenshotGallery"; import { PostList } from "../../components/devblog/PostList"; import { Newsletter } from "../../components/forms/Newsletter"; import { games, getGame } from "@/lib/games"; import { getPostsByGame } from "@/lib/devblog"; import { SITE_URL, STUDIO } from "@/lib/site"; type Props = { params: Promise<{ slug: string }> }; export function generateStaticParams() { return games.map((game) => ({ slug: game.slug })); } export async function generateMetadata({ params }: Props): Promise { const { slug } = await params; const game = getGame(slug); if (!game) return {}; return { title: game.title, description: game.tagline, alternates: { canonical: `${SITE_URL}/games/${game.slug}` }, openGraph: { type: "website", title: game.title, description: game.tagline, url: `${SITE_URL}/games/${game.slug}`, images: game.keyArt ? [`${SITE_URL}${game.keyArt}`] : undefined, }, }; } export default async function GamePage({ params }: Props) { const { slug } = await params; const game = getGame(slug); if (!game) notFound(); const relatedPosts = getPostsByGame(slug).slice(0, 3); // "1-6" → { minValue: 1, maxValue: 6 }, so search engines get the player // count as data rather than as a string buried in the description. const [minPlayers, maxPlayers] = (game.players ?? "") .split(/[-–]/) .map((part) => Number(part.trim())); const jsonLd = { "@context": "https://schema.org", "@type": "VideoGame", name: game.title, description: game.description, genre: game.genres, gamePlatform: game.platform, numberOfPlayers: minPlayers ? { "@type": "QuantitativeValue", minValue: minPlayers, maxValue: maxPlayers ?? minPlayers, } : undefined, playMode: maxPlayers && maxPlayers > 1 ? ["SinglePlayer", "CoOp"] : minPlayers ? "SinglePlayer" : undefined, publisher: { "@type": "Organization", name: STUDIO.name, url: SITE_URL, }, url: `${SITE_URL}/games/${game.slug}`, }; return (