Table of Contents
Sveltekit page store
How to use the sveltekit page store to access url parameters
Please use app/state if you are using Svelte 5
Example
import { page } from '$app/stores';
$: name = $page.url.searchParams.get('name');
// name = Thomas
import { page } from '$app/stores';
$: slug = $page.params.id;
// url: /snippets/[id] => slug = value of id
import { page } from '$app/stores';
$: path = $page.url.pathname;
// path = /test
Related snippets
Add Darkmode to sveltekit
How to add darkmode to a sveltekit project
Create images from HTML
How to convert html to an image on the server as a sveltekit API endpoint
Discord oAuth with Sveltekit
How to log in to a website with discord
Get License from package.json
How to get and show the projects license from package.json