Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
2 replies
MagerX

is there any way to redirect to the default 404 page after your search query on the server component

export async function generateMetadata(
  pageProps: PageProps
): Promise<Metadata> {
  const page = await getPageData(pageProps);
  return { title: page?.name ?? "Unable to find page" };
}

export default async function Home(pageProps: PageProps) {
  const pageData = await getPageData(pageProps);
  console.log("page", pageData);

  if (!pageData) {
    return new Response("No data found", {
      status: 404,
    });
  }


Im not in a position where i dont want to build a custom 404 page because I have a lot more work to do, but essentially i need some form of method to redirect to nextjs 13 404 page when the slug doesnt match anything in my sluglist
Was this page helpful?