feat: change metadata when tags are present in index page

This commit is contained in:
trafficlunar 2025-05-16 19:45:21 +01:00
parent 37ee2bca63
commit 00096552ce
2 changed files with 23 additions and 1 deletions

View file

@ -15,7 +15,7 @@ const lexend = Lexend({
export const metadata: Metadata = {
metadataBase: new URL(process.env.BASE_URL!),
title: "TomodachiShare home for Tomodachi Life Miis!",
title: "TomodachiShare - home for Tomodachi Life Miis!",
description: "Discover and share Mii residents for your Tomodachi Life island!",
keywords: ["mii", "tomodachi life", "nintendo", "tomodachishare", "tomodachi-share", "mii creator", "mii collection"],
category: "Gaming",

View file

@ -5,11 +5,33 @@ import { auth } from "@/lib/auth";
import MiiList from "@/components/mii-list";
import Skeleton from "@/components/mii-list/skeleton";
import { Metadata } from "next";
interface Props {
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}
export async function generateMetadata({ searchParams }: Props): Promise<Metadata> {
const { tags } = await searchParams;
if (!tags) return {};
const description = `Discover Miis tagged ${tags} for your Tomodachi Life island!`;
return {
metadataBase: new URL(process.env.BASE_URL!),
title: `Miis tagged with '${tags}' - TomodachiShare`,
description,
keywords: [...tags, "mii", "tomodachi life", "nintendo", "tomodachishare", "tomodachi-share", "mii creator", "mii collection"],
openGraph: {
description,
},
twitter: {
description,
},
};
}
export default async function Page({ searchParams }: Props) {
const session = await auth();