Basic Svelte
Introduction
Bindings
Advanced Svelte
Advanced reactivity
Motion
Advanced bindings
Advanced transitions
Context API
Special elements
<script module>
Next steps
Basic SvelteKit
Introduction
Routing
Loading data
Headers and cookies
Shared modules
API routes
$app/state
Errors and redirects
Advanced SvelteKit
Page options
Link options
Advanced routing
Advanced loading
Environment variables
Conclusion
Ordinarily, a page inherits every layout above it, meaning that src/routes/a/b/c/+page.svelte
inherits four layouts:
src/routes/+layout.svelte
src/routes/a/+layout.svelte
src/routes/a/b/+layout.svelte
src/routes/a/b/c/+layout.svelte
Occasionally, it’s useful to break out of the current layout hierarchy. We can do that by adding the @
sign followed by the name of the parent segment to ‘reset’ to — for example +page@b.svelte
would put /a/b/c
inside src/routes/a/b/+layout.svelte
, while +page@a.svelte
would put it inside src/routes/a/+layout.svelte
.
Let’s reset it all the way to the root layout, by renaming it to +page@.svelte
.
The root layout applies to every page of your app, you cannot break out of it.
previous next
1
2
<h1>home</h1>