Basic Routing in Svelte

From the SvelteKit cheat sheet ยท Routing ยท verified Nov 2026

Basic Routing

File-based routing patterns

javascript
// Route file structure
src/routes/
  +page.svelte       // index (/)
  +layout.svelte     // root layout
  about/+page.svelte // /about
  blog/
    +page.svelte     // /blog
    [slug]/
      +page.svelte   // /blog/:slug

// Navigation uses plain links
<a href="/about">About</a>
<a href="/blog/my-post">Blog Post</a>
๐Ÿ“ File-based routing with folders and +page.svelte
๐ŸŽฏ Dynamic routes with [param], [...rest] and [[optional]]
๐Ÿ“Œ Read the current URL from page in $app/state
โšก Built-in preloading with data-sveltekit-* attributes

Continue with SvelteKit

Save the full cheat sheet or work through every related task.

More Svelte tasks

Back to the full SvelteKit cheat sheet