Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series

$

49

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Layout Resets

Here we will take a quick look at a layout reset. The layout reset is simple yet powerful and allows us to reset or stop using a defined layout anywhere in our app.

Downloads

Become a pro to download code and videos

Comments

User avatar

Barbara

4 months ago [edited]

layout reset removed

> __layout.reset has been removed in favour of named layouts: https://kit.svelte.dev/docs/layouts#named-layouts

How to solve: you can have multiple __layout files in the routes directory (not in posts directory). To differentiate them, in this case, do __layout-posts.svelte

Then rename the posts/about.svelte to posts/about@posts.svelte

And voila. Navigate to http://localhost:3000/posts/about to see the new layout.

User avatar

Doug

3 days ago

Very helpful, thanks. I know 1.0 will be out shortly, but still worthwhile to go through this stuff.

Zach

6 months ago

If anyone's having trouble using "page" as an input to the "load" function. Try using "params" directly. Seems to have changed in the latest release of Svelte Kit.

This is what (the start of) my working load function ended up looking like.

export async function load({ params }) {
    const post = {
        title: params.slug,
        date: new Date(),
        body: 'lorem ipsum'
    };

Want to join the conversation?

Become a Pro member today!