diff --git a/src/app/analytics/page.tsx b/src/app/analytics/page.tsx index 10fffce..cc9a249 100644 --- a/src/app/analytics/page.tsx +++ b/src/app/analytics/page.tsx @@ -1,13 +1,10 @@ import AnalyticsChart from "@/components/AnalyticsChart"; import Card from "@/components/Card"; import Container from "@/components/Container"; - +import { ScoresaberPlayerCountHistory } from "@/schemas/fascinated/scoresaberPlayerCountHistory"; +import { ssrSettings } from "@/ssrSettings"; import { Metadata } from "next"; -export const metadata: Metadata = { - title: "Search", -}; - async function getData() { const response = await fetch( "https://bs-tracker.fascinated.cc/analytics?time=30d", @@ -19,7 +16,26 @@ async function getData() { ); const json = await response.json(); - return json; + return json as ScoresaberPlayerCountHistory; +} + +export async function generateMetadata(): Promise { + const data = await getData(); + + const description = "View Scoresaber metrics and statistics over time."; + + return { + title: `Analytics`, + description: description, + openGraph: { + siteName: ssrSettings.siteName, + title: `Analytics`, + description: + description + + ` + Players currently online: ${data.history[data.history.length - 1].value}`, + }, + }; } export default async function Analytics() {