Complete the code to create a route for the home page in SvelteKit.
<script>
// This is the main page component
</script>
<h1>Welcome to the [1] page!</h1>In SvelteKit, the home page route is created by naming the file +page.svelte inside the routes folder. The term index is used to represent the root or home page.
Complete the code to define a dynamic route parameter in SvelteKit.
<script> import { page } from '$app/stores'; </script> <p>User ID: {$page.params.[1]</p>
Dynamic route parameters in SvelteKit are defined by wrapping the parameter name in square brackets in the file name, like [id]. The parameter is accessed as $page.params.id.
Fix the error in the route file name to correctly create a nested route in SvelteKit.
routes/[1]/+page.svelteTo create a nested route, use folders for each level. The folder names should not contain slashes. The correct folder structure is profile/settings with a +page.svelte inside the settings folder.
Fill both blanks to create a route with a dynamic user ID and a nested settings page.
routes/[1]/[2]/+page.svelte
The dynamic user ID is represented by a folder named [userId]. The nested settings page is a folder named settings. Together they form the route /[userId]/settings.
Fill all three blanks to create a route that shows a blog post by slug with an edit page nested inside.
routes/blog/[1]/[2]/+page.svelte // The dynamic slug folder is [3]
The dynamic slug folder is named [slug]. The nested edit page is a folder named edit. The comment confirms the dynamic folder is [slug].