Skip to content

Commit 06338b3

Browse files
committed
Closes #757. Added return notFound() to app/blog/[...slug]/page.tsx instead of under construction so that missing pages return 404s and default error page
1 parent 12b4ed2 commit 06338b3

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

app/blog/[...slug]/page.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import PostLayout from '@/layouts/PostLayout'
1212
import PostBanner from '@/layouts/PostBanner'
1313
import { Metadata } from 'next'
1414
import siteMetadata from '@/data/siteMetadata'
15+
import { notFound } from 'next/navigation'
1516

1617
const defaultLayout = 'PostLayout'
1718
const layouts = {
@@ -85,16 +86,7 @@ export default async function Page({ params }: { params: { slug: string[] } }) {
8586
const sortedCoreContents = allCoreContent(sortPosts(allBlogs))
8687
const postIndex = sortedCoreContents.findIndex((p) => p.slug === slug)
8788
if (postIndex === -1) {
88-
return (
89-
<div className="mt-24 text-center">
90-
<PageTitle>
91-
Under Construction{' '}
92-
<span role="img" aria-label="roadwork sign">
93-
🚧
94-
</span>
95-
</PageTitle>
96-
</div>
97-
)
89+
return notFound()
9890
}
9991

10092
const prev = sortedCoreContents[postIndex + 1]

0 commit comments

Comments
 (0)