Next.js Discord

Discord Forum

Layouts Question

Unanswered
Blue Picardy Spaniel posted this in #help-forum
Open in Discord
Blue Picardy SpanielOP
I have a layout in my root and a layout in my dashboard. How do I stop my footer from being in my dashboard layout?

3 Replies

@Blue Picardy Spaniel I have a layout in my root and a layout in my dashboard. How do I stop my footer from being in my dashboard layout?
Turkish Van
You can accomplish that by using the Route Groups. With Route Groups You are able to apply different layouts to the pages on the same level.

Take a look here: https://nextjs.org/docs/app/building-your-application/routing/route-groups#opting-specific-segments-into-a-layout
@Blue Picardy Spaniel so this is the only way to do it?
Turkish Van
Layout, in general, is a UI shared between multiple routes. By default, it will be used across all the nested routes.

Since one of the two main usages of Route Groups is being able to create multiple nested layouts in the same segment, I would say no, there isn't any other way to achieve that.

I assume, the page.tsx is meant to be the landing page.

If You wanted the other way, You might want to try wrapping Your landing page, which is not a dashboard, inside an extra route segment with its layout placed inside. But, I don't think You would want to do that.

Also, if You prefer, You could do the opposite. You could also wrap the landing page inside of its Route Group and achieve the same thing.