Next.js Discord

Discord Forum

how to hide layout on 404 page

Answered
Norwegian Forest Cat posted this in #help-forum
Open in Discord
Avatar
Norwegian Forest CatOP
how to make my navbar showing in everypage except for the 404 page?
Answered by Alfonsus Ardani
You can create a route group where you put your navbar inside the route group so that when it redirects to the 404 page it doesn't include the navbar inside the route group
View full answer

9 Replies

Avatar
You can create a route group where you put your navbar inside the route group so that when it redirects to the 404 page it doesn't include the navbar inside the route group
Answer
Avatar
Try
app/layout.tsx
app/(witHNavbar)/layout.tsx
Avatar
@Alfonsus Ardani Try tsx app/layout.tsx app/(witHNavbar)/layout.tsx
Avatar
Norwegian Forest CatOP
soo the home page should be on the (withnavbar) directory right?
Avatar
@Alfonsus Ardani Try tsx app/layout.tsx app/(witHNavbar)/layout.tsx
Avatar
Norwegian Forest CatOP
its working, thanks 👍
Image
Avatar
Norwegian Forest CatOP
what is this error? @Alfonsus Ardani
Image
Avatar
thats a separate problem
Avatar
@Alfonsus Ardani thats a separate problem
Avatar
Norwegian Forest CatOP
what does that error mean?
Avatar
its another problem, maybe you can open up a thread and tell me about the issue