Optional and Rest Parameters
Handle optional segments with [[optional]] and catch-all routes with [...rest].
Optional Segments
Use double brackets [[optional]] to make a segment optional.
src/routes/[[lang]]/about/+page.svelteBoth URLs Match
The above matches both /about and /en/about. lang is undefined for the first.
All lessons in this course
- File-based Routing with +page.svelte
- Dynamic Route Parameters: [id]
- Optional and Rest Parameters
- Layout Files: +layout.svelte