Skip to content

Commit 1bdae49

Browse files
committed
fix(404): update not found page to work on GitHub Pages
1 parent a2b82a9 commit 1bdae49

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"start": "next start",
88
"lint": "eslint .",
99
"lint:fix": "eslint . --fix",
10-
"postbuild": "pagefind --site .next/server/app --output-path out/_pagefind"
10+
"postbuild": "pagefind --site .next/server/app --output-path public/_pagefind && cp out/404/index.html out/404.html"
1111
},
1212
"dependencies": {
1313
"@commitlint/cli": "^20.3.0",

src/app/404/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import NotFoundCanvas from '@/components/NotFoundCanvas';
2+
3+
export default function NotFound() {
4+
return (
5+
<div style={{ textAlign: 'center', padding: '2rem' }}>
6+
<h1>Page not found</h1>
7+
<p>Sorry, that page does not exist.</p>
8+
<div style={{ maxWidth: '800px', margin: '0 auto' }}>
9+
<NotFoundCanvas />
10+
</div>
11+
</div>
12+
);
13+
}

src/app/not-found.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
import NotFoundCanvas from '@/components/NotFoundCanvas';
1+
import NotFound from '@/app/404/page';
22

3-
export default function NotFound() {
4-
return (
5-
<div style={{ textAlign: 'center', padding: '2rem' }}>
6-
<h1>Page not found</h1>
7-
<p>Sorry, that page does not exist.</p>
8-
<div style={{ maxWidth: '800px', margin: '0 auto' }}>
9-
<NotFoundCanvas />
10-
</div>
11-
</div>
12-
);
13-
}
3+
export default NotFound;

src/content/404.mdx

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)