How to make a layout for every page except index?

As the title says, i want to make a layout to affect every page but index in routes directory using solid start and im not sure how to
4 Replies
Tommypop
Tommypop2y ago
I think you can use route groups and then apply the layout to that So just create a folder, whose name is surrounded in brackets, which contains all of the files that you want the layout to apply to and then create a file shadowing that directory with your layout inside of it
echoptic
echopticOP2y ago
tnx for the answer, could you provide an example how would that directory look?
Martnart
Martnart2y ago
routes/
index.tsx <- page without layout
(layout).tsx <- layout goes here
(layout)/
routeA.tsx <- with layout
routeB.tsx <- with layout
routes/
index.tsx <- page without layout
(layout).tsx <- layout goes here
(layout)/
routeA.tsx <- with layout
routeB.tsx <- with layout
etc. Layout is a random name, it could be anything, as long as your layout file name matches the directory name
echoptic
echopticOP2y ago
cool, this works, but now im sometimes getting an error: error loading dynamically imported module nvm it fixed itself
Want results from more Discord servers?
Add your server