import { serverClient } from "@/lib/trpc/server" import type { ContentTypeParams, LangParams, PageArgs, UIDParams, } from "@/types/params" export async function generateMetadata({ searchParams, }: PageArgs< LangParams & ContentTypeParams & UIDParams, { subpage?: string; filterFromUrl?: string } >) { const { subpage, filterFromUrl, ...otherSearchParams } = searchParams // If there are other (real) search params, we don't want to index the page as this will // cause duplicate content issues. const noIndexOnSearchParams = !!Object.keys(otherSearchParams).length const metadata = await serverClient().contentstack.metadata.get({ subpage, filterFromUrl, noIndex: noIndexOnSearchParams, }) return metadata }