I want to have a default layout with a navbar that should be applied to all pages except certain "account" pages (e.g., Sign In, Sign Out, Register).
Here's what I've done so far:
- I created two groups (account) and (main) to separate the layout behaviors.
- I added the layout and the page file directly into the (main) group so that the main index page (/) will use the layout and pages within this group.
However, I'm facing a challenge with applying this default layout to error pages.
The Problem:
If I create a +error.svelte document in the root directory, it doesn't use the layout in the (main) group. On the other hand, if I place +error.svelte within the (main) group, even errors on the main pages don't get the layout because the error seems to propagate to the parent folder structure(?).
What I'm Looking For:
How can I configure SvelteKit so that all error pages, regardless of the group they originate from, use the default layout from the (main) group? (Even errors from the account group have the default layout)
Current Folder Structure:
src/
├── routes/
│ ├── (account)/
│ │ ├── account/
│ │ │ └── +page.svelte
│ │ └── +layout.svelte
│ ├── (main)/
│ │ ├── __layout.svelte (Main layout with navbar)
│ │ ├── index.svelte (Main index page)
│ │ └── ... (Other pages that use the main layout)
Expected Folder Structure:
src/
├── routes/
│ ├── (account)/
│ │ └── ... (like above)
│ ├── (main)/
│ │ ├── +layout.svelte (Main layout with navbar)
│ │ ├── +page.svelte
│ │ └── ... (Other pages that use the main layout)
│ └── +error.svelte (Expected to have the layout from the (main) group but doesn't)