From 6b25e5918bc92b22071460b12f7517e6c20be5d1 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Mon, 25 May 2026 19:36:27 +0800 Subject: [PATCH] fix: use smartTruncate for game meta descriptions, prevent mid-word cutoff (Task 7) --- app/game/[id]/page.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/game/[id]/page.tsx b/app/game/[id]/page.tsx index b7ee56f..ffbbba3 100644 --- a/app/game/[id]/page.tsx +++ b/app/game/[id]/page.tsx @@ -16,6 +16,7 @@ import { import { and, desc, eq, sql } from "drizzle-orm" import { isSyncStale, syncSteamGame, ensureSteamGame } from "@/lib/steam/sync" import { getR2PublicUrl } from "@/lib/storage" +import { smartTruncate } from "@/lib/utils/seo" import { GamePageClient } from "./game-page-client" // This page needs live data — skip static generation at build time @@ -62,8 +63,8 @@ export async function generateMetadata({ params }: { params: Promise<{ id: strin } const description = game.description - ? game.description.slice(0, 160) - : `Find benchmarks, community presets, and performance settings for ${game.title} on Steam Deck.` + ? smartTruncate(game.description, 160) + : `Find benchmarks, community presets, and performance settings for ${game.title} on Steam Deck. Compare FPS, TDP, and battery life from community reports.` return { title: `${game.title} - Benchmarks & Settings`, @@ -71,7 +72,7 @@ export async function generateMetadata({ params }: { params: Promise<{ id: strin alternates: { canonical: `https://deckyvault.xyz/game/${game.id}` }, openGraph: { title: `${game.title} - Benchmarks & Settings | DeckyVault`, - description: game.description?.slice(0, 200) ?? `Benchmarks and settings for ${game.title}`, + description: game.description ? smartTruncate(game.description, 200) : `Benchmarks and settings for ${game.title}`, url: `https://deckyvault.xyz/game/${game.id}`, images: [{ url: `/game/${game.id}/opengraph-image`, width: 1200, height: 630 }], type: "website", @@ -80,7 +81,7 @@ export async function generateMetadata({ params }: { params: Promise<{ id: strin twitter: { card: "summary_large_image", title: `${game.title} - Benchmarks & Settings | DeckyVault`, - description: game.description?.slice(0, 200) ?? `Benchmarks and settings for ${game.title}`, + description: game.description ? smartTruncate(game.description, 200) : `Benchmarks and settings for ${game.title}`, images: [`/game/${game.id}/opengraph-image`], }, }