Next.js Discord

Discord Forum

Custom not-found.tsx not rendering

Unanswered
Chalcid wasp posted this in #help-forum
Open in Discord
Avatar
Chalcid waspOP
Structure:
app/(management)/guidebooks/[guidebookId]/
  ├─ layout.tsx    - Calls notFound() when guidebook not found
  ├─ not-found.tsx - Custom 404 page
  └─ cover/page.tsx

Issue: Custom not-found.tsx isn't rendering when guidebook isn't found. Shows default Next.js 404 instead.

Any ideas what might be wrong?

6 Replies

Avatar
can you move your not-found page one layer up and check again?
Avatar
Chalcid waspOP
Inside the cover folder you say? if so, already tried that, its stills show to default 404
Avatar
nah one layer up from the component that calls it. Also: add a page.tsx to your guidebookid-page
Avatar
@Chalcid wasp solved?
Avatar
Chalcid waspOP
Hey, sorry forgot to answer but couldn't fix so i just gave up on that, i will come back to it later
Avatar
I just rebuild your project and it works fine: https://codesandbox.io/p/devbox/young-grass-vxx65n