URL parameters

Routify can access URL parameters by using parameterized files and folders.

A file or folder is parameterized if it is wrapped in brackets. (ie. [slug].svelte or [slug]/index.svelte)

Local parameters

A parameterized file/folder can access its parameter with

export let slug

A Folder's parameter is passed to [slug]/_layout.svelte

Global parameters

To access all parameters from anywhere, use the $params helper.

import { params } from '@sveltech/routify' $: slug = $params.slug
import { params } from '@sveltech/routify'
$: slug = $params.slug


Local parameters are directly synchronized with the address bar whereas global parameters are first propagated through the layout component chain. The propagation is to prevent race conditions between parameters and component state.

Writing good documentation that is up-to-date is difficult. If you notice a mistake, help us out.