feat: add global 404 page

This commit is contained in:
xfy
2025-05-19 20:09:20 +08:00
parent 39089feea8
commit 7b6bf536ea
10 changed files with 48 additions and 13 deletions

View File

@ -10,14 +10,18 @@ const GlobalError = ({
error: Error & { digest?: string };
reset: () => void;
}) => {
console.error(error);
return (
<html>
<body
className={clsx('w-full h-dvh flex', 'justify-center items-center')}
>
<div>
<h2 className="text-xl">Something went wrong! ( OωO)</h2>
<Button onClick={() => reset()}>Try again</Button>
<h2 className="text-xl mb-1">Something went wrong! ( OωO)</h2>
<Button onClick={() => reset()} className="cursor-pointer">
Try again
</Button>
</div>
</body>
</html>

15
app/not-found.tsx Normal file
View File

@ -0,0 +1,15 @@
import Button from 'components/rua/button';
import Link from 'next/link';
export default function NotFound() {
return (
<main className="flex-1 w-full max-w-4xl mx-auto flex items-center justify-center">
<div>
<h2 className="text-xl mb-1"> ( ||)</h2>
<Link href="/">
<Button className="cursor-pointer">Home</Button>
</Link>
</div>
</main>
);
}

View File

@ -16,7 +16,6 @@ const PostToc = dynamic(() => import('components/post/post-toc'));
const PostCommnetLine = dynamic(
() => import('components/post/post-commnet-line'),
);
const PostComment = dynamic(() => import('components/post/post-comment'));
export async function generateStaticParams() {
return await allPostsPath();