Redirect instead of 404'ing on root route

This commit is contained in:
Morgan Dean
2025-06-10 18:15:20 -04:00
parent 56527f7752
commit 6d78be2029

View File

@@ -5,7 +5,7 @@ import {
DocsDescription,
DocsTitle,
} from 'fumadocs-ui/page';
import { notFound } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { getMDXComponents } from '@/mdx-components';
@@ -14,7 +14,7 @@ export default async function Page(props: {
}) {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) notFound();
if (!page) redirect('/home');
const MDXContent = page.data.body;