feat: add AggregateRating JSON-LD to game detail pages (Task 10)

This commit is contained in:
2026-05-25 19:40:52 +08:00
parent d4ff5a26a6
commit ad7c361d0d
+20
View File
@@ -391,6 +391,26 @@ export default async function GamePage({
),
}}
/>
{/* AggregateRating — based on Steam review score when available */}
{game.steamReviewScore != null && (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "AggregateRating",
itemReviewed: {
"@type": "VideoGame",
name: game.title,
},
ratingValue: (game.steamReviewScore / 10).toFixed(1),
bestRating: "10",
worstRating: "0",
ratingCount: game.steamReviewCount ?? undefined,
}),
}}
/>
)}
<Suspense fallback={<div className="min-h-screen" />}>
<GamePageClient
game={serializedGame}