Next.js Discord

Discord Forum

not-found.js

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
With the not-found.js (404 page) is it possible to not inherit from the layout.tsx because i dont want stuff like the navbar or footer on them pages that have the 404 error just something saying it could not be found.

14 Replies

Brown bearOP
so like /src/app/home/main content
and put the not-found in /src/app/not-found.js
would that mean its domain/home/page when using it on a website?
Havana
no he means simply group the routes under (home) dir, doesnt affect any of your routes on the website
I do have a similar issue, i do want the not-found in my app to inherit from the rootlayout, but it does not seem to work for me like that the nav and footer js tend to be out of place for my not-found page, any idea how can i work around that?
Brown bearOP
okay thanks ill check that out
Havana
np!
Brown bearOP
but with your issue i dont have that problem, the navbar and footer just stay in the same place no matter what page im on.
Havana
have you used specific css styling on them like fixing their position?
my footer just overlaps on top of my nav, with my not-found being rendering behind the two elements
Brown bearOP
yes
the css fixes their position