I’m trying to set up a route tree where most routes inside a section use a layout, but certain deep nested routes inside that same section must opt out of that layout.
🔧 Structure I’m trying to achieve
/app
/portal # Authenticated area — provides the main layout (sidebar, nav)
/home # Uses portal layout
/projects # Uses portal layout
/$projectId # Uses portal layout
/edit # ❌ Should NOT use portal layout
/activity # Uses portal layout
💡 Goal / Intent
/app/portal/* normally shares a layout (sidebar + top nav).
But a specific nested route (/projects/$projectId/edit) should not render inside that layout.
Basically:
/portal/** → ✔️ uses layout
/portal/projects/$id/edit → ❌ bypasses layout entirely
❗The issue
Even when I move the edit route into its own folder, TanStack still loads the portal layout because it’s the parent route in the tree.
Question:
Is it possible in TanStack Router to create a route subtree like the above where a child route opts out of its parent layout?
If so, what would be the correct folder/route setup to make /edit completely bypass the /portal layout while still living inside the /portal/projects/$projectId path segment? but keeping a nice organization in the project?