Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/pages/404.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Page not found
description: The page you're looking for doesn't exist. Navigate back to Tempo documentation.
---

<div className="flex flex-col items-center justify-center text-center py-16">
<div className="text-[120px] font-bold text-[var(--vocs-color_text3)] leading-none select-none">404</div>
<h1 className="text-2xl font-semibold mt-4 mb-2">Page not found</h1>
<p className="text-[var(--vocs-color_text2)] max-w-md mb-8">
The page you're looking for doesn't exist or may have been moved.
</p>
<a href="/" className="text-[var(--vocs-color_textAccent)] hover:underline">
← Back to home
</a>
</div>
21 changes: 21 additions & 0 deletions vocs.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,4 +645,25 @@ export default defineConfig({
},
},
},
vite: {
plugins: [
{
// Vocs's default NotFound component shows a generic 404 page.
// This patches it to redirect to our custom /404 page instead.
name: 'fix-404-route',
transform(code, id) {
if (!id.includes('vocs/_lib/app/routes')) return
return code
.replace(
"import { NotFound } from './components/NotFound.js';",
"import { Navigate } from 'react-router';",
)
.replace(
'_jsx(NotFound, {})',
'_jsx(Navigate, { to: "/404", replace: true })',
)
},
},
],
},
})