/blog/42?src/routes/ āāā +page.svelte āāā blog/ ā āāā +page.svelte ā āāā [id]/+page.svelte āāā about/+page.svelte
Which component will render when the user visits
/blog/42?The URL /blog/42 matches the dynamic route [id] inside the blog folder. So src/routes/blog/[id]/+page.svelte renders.
/docs, including nested paths like /docs/intro/setup?The catch-all route syntax uses [...name] to match any nested path segments. So [...all] is correct.
/profile show a 404 error?src/routes/ āāā +page.svelte āāā profile/[user]/+page.svelte
Visiting
/profile shows a 404 error. Why?In SvelteKit, to serve /profile, the file src/routes/profile/+page.svelte must exist. If profile is a folder, the file must be inside it as +page.svelte. The correct is to have profile/+page.svelte as a file inside the folder.
params.id for URL /shop/123?src/routes/shop/[id]/+page.svelte with this script:<script>
export let params;
</script>
<p>ID: {params.id}</p>What will be displayed when visiting
/shop/123?The dynamic segment [id] captures the URL part 123 and passes it as params.id.
/dashboard/settings/profile?src/routes/ āāā dashboard/+layout.svelte āāā dashboard/settings/+page.svelte āāā dashboard/settings/profile/+page.svelte āāā dashboard/settings/profile/+layout.svelte
Which file is responsible for rendering the content at
/dashboard/settings/profile?The +page.svelte file renders the page content. Layouts wrap around pages to provide shared UI but do not replace the page content.
