Remove layout from lower pages
Answered
Giant ichneumon wasp posted this in #help-forum
Giant ichneumon waspOP
So I have:
app
|- login
|- register
I want
app
|- login
|- register
I want
app (/) and the rest of the application to show their nested layouts but not login or register, how can I opt them out of the upper layout? Or how can one bypass this situation? I thought about creating a lower page and intercepting that route in the root pageAnswered by European sprat
7 Replies
Answer
Giant ichneumon waspOP
@European sprat I've read that, yet I can't see how it helps me
European sprat
- app
- - (everything except login/logout)
- - - layout.tsx
- - - page.tsx
- - (login/logout)
- - - login/
- - - logout/
- - - layout.tsx
does something like that work?
- - (everything except login/logout)
- - - layout.tsx
- - - page.tsx
- - (login/logout)
- - - login/
- - - logout/
- - - layout.tsx
does something like that work?
@Giant ichneumon wasp So I have:
app
|- login
|- register
I want `app` (/) and the rest of the application to show their nested layouts but not `login` or `register`, how can I opt them out of the upper layout? Or how can one bypass this situation? I thought about creating a lower page and intercepting that route in the root page
Use route groups. The docs are pretty clear about this and there are examples on how to implement multiple root layouts, which seems to be what you're looking for.
See this: https://nextjs.org/docs/app/building-your-application/routing/route-groups#creating-multiple-root-layouts
See this: https://nextjs.org/docs/app/building-your-application/routing/route-groups#creating-multiple-root-layouts
Sorry, I didn't notice there was already a response 😅
European sprat
oh yeah there's an example for multiple root layouts there, forgot about that
Giant ichneumon waspOP
yeah that helped thanks @European sprat @not-milo.tsx