add metadata and opengraph tags
This commit is contained in:
@@ -2,6 +2,38 @@ import GameAuthWrapper from "@/components/game/GameAuthWrapper";
|
|||||||
import { getGame } from "@/lib/game";
|
import { getGame } from "@/lib/game";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
|
|
||||||
|
export async function generateMetadata({ params }: { params: { code: string } }) {
|
||||||
|
const game = await getGame(params.code);
|
||||||
|
if (!game) {
|
||||||
|
return {
|
||||||
|
description: "Game not found",
|
||||||
|
robots: {
|
||||||
|
index: false,
|
||||||
|
follow: false,
|
||||||
|
nocache: true,
|
||||||
|
noarchive: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
description: `Play or watch a game with ${game.host?.name}`,
|
||||||
|
openGraph: {
|
||||||
|
title: "chessu",
|
||||||
|
description: `Play or watch a game with ${game.host?.name}`,
|
||||||
|
url: `https://ches.su/game/${game.code}`,
|
||||||
|
siteName: "chessu",
|
||||||
|
locale: "en_US",
|
||||||
|
type: "website"
|
||||||
|
},
|
||||||
|
robots: {
|
||||||
|
index: false,
|
||||||
|
follow: false,
|
||||||
|
nocache: true,
|
||||||
|
noarchive: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default async function Game({ params }: { params: { code: string } }) {
|
export default async function Game({ params }: { params: { code: string } }) {
|
||||||
const game = await getGame(params.code);
|
const game = await getGame(params.code);
|
||||||
if (!game) {
|
if (!game) {
|
||||||
|
|||||||
@@ -8,7 +8,21 @@ import ContextProvider from "@/context/ContextProvider";
|
|||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "chessu",
|
title: "chessu",
|
||||||
description: "Play Chess online."
|
description: "Play Chess online.",
|
||||||
|
openGraph: {
|
||||||
|
title: "chessu",
|
||||||
|
description: "Play Chess online.",
|
||||||
|
url: "https://ches.su",
|
||||||
|
siteName: "chessu",
|
||||||
|
locale: "en_US",
|
||||||
|
type: "website"
|
||||||
|
},
|
||||||
|
robots: {
|
||||||
|
index: true,
|
||||||
|
follow: false,
|
||||||
|
nocache: true,
|
||||||
|
noarchive: true
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user