RSC: Shared layout in different paths

Using Next 13 how would someone share the same layout for two pages that are not in the same directory? In this example I want pageOne and pageTwo to have the same layout but I also want login to not have it so I cannot use the layout 1 level higher. I tried re-exporting the layout of pageOne form pageTwo's layout.tsxand it works but it feels a bit weird
No description
11 Replies
Pranav Rajveer
Pranav Rajveer10mo ago
No description
Pranav Rajveer
Pranav Rajveer10mo ago
You can probably use a structure like this tbh. .
Nicolas
Nicolas10mo ago
Thank you @neon20 this seems very good, however it means pageone and pagetwo would need to be in a common ancestor and the URLs would be common/pageone, /common/pagetwo and /login instead of just /pageone, /pagetwo and /login
Pranav Rajveer
Pranav Rajveer10mo ago
No, the "(" ")" notation in nextjs means that your (pages) will be masked and you dont have to do /pages/pageone. Instead you can just do /pagesone and /pagestwo
Nicolas
Nicolas10mo ago
Ooooh okay that’s very cool, I missed it in the docs
Pranav Rajveer
Pranav Rajveer10mo ago
[[...sign-in-ID]] also if you are looking for dynamic routing this notation would help Best of luck👍
Nicolas
Nicolas10mo ago
Thanks for sharing, do you know the name of this feature? So I can search the docs
Pranav Rajveer
Pranav Rajveer10mo ago
just search on chatgpt, you can get it easily
Nicolas
Nicolas10mo ago
Haha will try 👍🏻
Pranav Rajveer
Pranav Rajveer10mo ago
👍