#Multiple layout

1 messages · Page 1 of 1 (latest)

kindred axle
#

Hey, I have the following folder structure:
app -> page -> dashboard -> page.js
app -> page -> layout.js
app -> page -> setup -> page.js

Now I would like to that the setup route does not have the layout.js. The dashboard should have the layout.js. I tried it by create another layout.js in app -> page -> setup -> layout.js but that will be wrapped by the other layout.js as child. So I can't use that. How can I disable the layout for specific routes? Route groups doesn't work for me in this case.

novel thornBOT
#

Hi @kindred axle. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, it seems that you're trying to opt-out a specific route from a shared layout. However, the extracts do not provide a direct solution for disabling a layout for specific routes if route groups are not an option.

Layouts in Next.js are nested by default, meaning they wrap child layouts via their children prop. If a layout.js file is defined in a folder, it applies to specific route segments and renders when those segments are active.

One workaround could be to conditionally render the layout based on the route. However, the extracts do not provide enough information to confidently suggest this approach.

For more detailed guidance, you might want to refer to the official Next.js documentation or community forums.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: