Next.js Discord

Discord Forum

Remove parrent layout on certain pages in Nextjs 15

Answered
Asian black bear posted this in #help-forum
Open in Discord
Avatar
Asian black bearOP
i wanna remove navbar and footer from chat page
Answered by chisto
you need 2 route groups
withNavbarAndFooter layout will have a layout with navbar and footer and all folders there that u want to have those
and the layout in withoutNavBarAndFooter wont have those
Image
View full answer

6 Replies

Avatar
you have to make 2 route groups and separate layouts so they don't share footer and navbar
Avatar
@chisto you have to make 2 route groups and separate layouts so they don't share footer and navbar
Avatar
Asian black bearOP
I don't get it you mean like

app => {
chat => {
layout.tsx
page.tsx
[id]
}
page.tsx
layout.tsx
}
Avatar
you cant have the footer and navbar on the root layout because it will be shared with everything
Avatar
you need 2 route groups
withNavbarAndFooter layout will have a layout with navbar and footer and all folders there that u want to have those
and the layout in withoutNavBarAndFooter wont have those
Image
Answer
Avatar
Asian black bearOP
thanks !