Replies: 1 comment
-
Found my answer in the docs. If you don't create a root layout file, SvelteKit has a default. So the above is expected behavior; as you are in fact referencing an existing root layout; even if you didn't create the file yourself. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been wanting to record a video about layouts, so I've been experimenting. One aspect of confusion is resetting with
@
, and how to design routes which don't inherit from the root layout.For example, people will do
src/routes/admin/+page@.svelte
and expect the admin page to not inherit from the root layout. So they're essentially trying to reset to a blank layout. But, as we now know, this simply resets them to the root layout.I've seen two ways of not inheriting from the root layout:
src/routes/+layout.svelte
file. Only create layout groups or regular directory routes. Then you can create whatever layouts you want, even if none of them are a blank layout. So in the example, none of the pages under(corp)
will inherit from layouts in(main)
and vice versa.src/routes/+layout.svelte
. Then if you want to reset to a blank layout, reference it with+page@.svelte
or+layout@.svelte
.But I just ran across another way to reset to a blank layout: Don't even create the blank root layout file from number 2. Then if you reference the root layout, in either of the above two scenarios, your
+page@.svelte
or+layout@.svelte
will inherit from a non-existing root layout file - which of course is blank. In this example, it doesn't matter ifmarketing
is a directory or if you transform it into a layout group with(marketing)
. Either way, thecareers/+page@.svelte
will not inherit the marketing layout file and will be reset to a blank layout.My question is, are we supposed to be able to reference a non-existing
src/routes/+layout.svelte
file and not get an error? If this is expected behavior, I believe some clarifications in the docs will help people understand their options.Beta Was this translation helpful? Give feedback.
All reactions