Next.js Discord

Discord Forum

how to hide layout on 404 page

Answered
Norwegian Forest Cat posted this in #help-forum
Open in Discord
Norwegian Forest CatOP
how to make my navbar showing in everypage except for the 404 page?
Answered by alfonsus
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

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
Try
app/layout.tsx
app/(witHNavbar)/layout.tsx
@alfonsus Try tsx app/layout.tsx app/(witHNavbar)/layout.tsx
Norwegian Forest CatOP
soo the home page should be on the (withnavbar) directory right?
@alfonsus Try tsx app/layout.tsx app/(witHNavbar)/layout.tsx
Norwegian Forest CatOP
its working, thanks 👍
Norwegian Forest CatOP
what is this error? @alfonsus
thats a separate problem
@alfonsus thats a separate problem
Norwegian Forest CatOP
what does that error mean?
its another problem, maybe you can open up a thread and tell me about the issue