Seems like the new way of using layouts doesn't work with index svelte files
See original GitHub issueDescribe the bug
Hi, It seems like if you create an index.svelte with a named layout doesn’t recognise it as the root ‘page’ of that folder or subfolder. eg:
├ x/
│ ├ __layout-foo.svelte
│ ├ index@foo.svelte
│ └ someotherpage@foo.svelte
├ __layout-global.svelte
└ index@global.svelte
here all index[@…].svelte files give 404’s (unless i’m not getting the concept of the new layouts)
Reproduction
create the following in your routes folder: src/routes/
├ x/
│ ├ __layout-foo.svelte
│ ├ index@foo.svelte
│ └ someotherpage@foo.svelte
├ __layout-global.svelte
└ index@global.svelte
start dev server and go to the root page
Logs
No response
System Info
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 570.61 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.7.2 - /opt/homebrew/bin/node
npm: 8.5.2 - /opt/homebrew/bin/npm
Browsers:
Chrome: 100.0.4896.75
Firefox: 97.0.1
Safari: 15.4
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.34
@sveltejs/adapter-node: ^1.0.0-next.73 => 1.0.0-next.73
@sveltejs/kit: next => 1.0.0-next.306
svelte: ^3.46.6 => 3.46.6
Severity
serious, but I can work around it
Additional Information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Dynamic behavior in Svelte: working with variables and props
Learn and put into practice some basic Svelte concepts, like creating components, passing data using props, rendering JavaScript expressions ...
Read more >Using SvelteKit 1.0 on Vercel
The load function: SvelteKit has a unique way of loading page data using the load function. All +page.svelte files can have a sibling...
Read more >Escape Root Layout Svelte Sveltekit - Stack Overflow
You can omit this, by using layout@.svelte . However in want to omit the root layout file at src/routes/layout.svelte . Is there a...
Read more >Introduction • Docs • SvelteKit
In short, it's a UI framework that compiles your components to highly optimized vanilla JavaScript. Read the introduction to Svelte blog post and...
Read more >Exploring SvelteKit in 2022 by Building a Portfolio Website
Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Well i was doing some testing, on first sight it looks like it works with the other way of creating that ‘index’ page for a folder/subfolder. eg:
This seems to work just fine, it is way less visible what an index page is for a certain path though (imo). This for me personally is only a workaround because in the case that you have a lot of ‘index’ pages for a lot of different paths with specifically other named layouts, it will get messy very quickly in the root of that folder. (just my opinion though)
Ok this worked for the slug