Layout.tsx issue
Answered
In&Out posted this in #help-forum
In&OutOP
| layout.tsx
| page.tsx
|
+---(editor)
| \---editor
| | layout.tsx
| | page.tsx
| |
| +---[...custom_page]
| | | layout.tsx
| | | page.tsx
| | |
| | \---_components
| | | Sidebar.module.css
| | | Sidebar.tsx
| | | UserCompound.module.css
| | | UserCompound.tsx
| | |
| | +---elements
| | | | ElementsList.module.css
| | | | ElementsList.tsx
| | | | Helpers.tsx
| | | |
| | | \---img
| | | nd.jpg
| | | Np.png
| | | vesti_1.png
| | | vesti_2.png
| | | vesti_3.png
| | |
| | +---sidebar
| | | | ElementSidebar.tsx
| | | | ExtraSidebar.module.css
| | | | ExtraSidebar.tsx
| | | | TextSidebar.tsx
| | | | ThemeSidebar.tsx
| | | |
| | | \---css
| | | ElementSidebar.module.css
| | | TextSidebar.module.css
| | | ThemeSidebar.module.css
| | |
| | \---store
| | dashboardStores.tsx
| |
| \---_components
| | Main.module.css
| | Sidebar.tsx
| | UpperNavbar.tsx
| |
| +---css
| | Sidebar.module.css
| | UpperNavbar.module.css
| |
| \---helpers
| +---sidebar
| | Editor.module.css
| | Editor.tsx
| | Pagepicker.module.css
| | Pagepicker.tsx
| |
| \---uppernav
| SaveButton.module.css
| SaveButton.tsx
|
\---_components
Answered by Asian black bear
You just need something like this:
/dashboard/(editor)/editor/layout.tsx
/dashboard/(everything-else)/...
14 Replies
In&OutOP
i have issues with nextjs layouts, in 1 folder i have 5 routes for dashboard, all will have 1 layout except /dashboard/editor which will have own layout, how do i make editor only use layout thats in that folder while others use layout in /dashboard
Asian black bear
Using route groups - check the docs how to split your pages using those, allowing for separate layouts.
i did that already, see top of that folder structure
or do i have to remove it from folder
Asian black bear
Most of your hierarchy you posted is not helping to understand your actual structure. You just have to ensure the path you want a separate layout for is in a separate group to everything else.
Asian black bear
You just need something like this:
/dashboard/(editor)/editor/layout.tsx
/dashboard/(everything-else)/...
Answer