diff --git a/apps/kit.svelte.dev/vercel.json b/apps/kit.svelte.dev/vercel.json index 5c0aa893c8..4df4ecb39f 100644 --- a/apps/kit.svelte.dev/vercel.json +++ b/apps/kit.svelte.dev/vercel.json @@ -6,6 +6,16 @@ "destination": "https://svelte.dev/", "permanent": true }, + { + "source": "/docs/layouts", + "destination": "https://svelte.dev/docs/kit/routing", + "permanent": true + }, + { + "source": "/docs/loading", + "destination": "https://svelte.dev/docs/kit/load", + "permanent": true + }, { "source": "/docs/modules", "destination": "https://svelte.dev/docs/kit/@sveltejs-kit" diff --git a/apps/svelte.dev/content/blog/2021-03-23-sveltekit-beta.md b/apps/svelte.dev/content/blog/2021-03-23-sveltekit-beta.md index e778fbd020..0a4b42c4c5 100644 --- a/apps/svelte.dev/content/blog/2021-03-23-sveltekit-beta.md +++ b/apps/svelte.dev/content/blog/2021-03-23-sveltekit-beta.md @@ -24,7 +24,7 @@ npm install npm run dev -- --open ``` -You'll find documentation at [kit.svelte.dev/docs](https://kit.svelte.dev/docs). If you have a [Sapper](https://sapper.svelte.dev) app that you'd like to migrate to SvelteKit, you'll find instructions at [kit.svelte.dev/docs/migrating](https://kit.svelte.dev/docs/migrating). +You'll find documentation at [svelte.dev/docs/kit](/docs/kit). If you have a [Sapper](https://sapper.svelte.dev) app that you'd like to migrate to SvelteKit, you'll find instructions at [svelte.dev/docs/kit/migrating](/docs/kit/migrating). The source code is available at [github.com/sveltejs/kit](https://github.com/sveltejs/kit). Issues and pull requests are disabled while we finish getting our house in order, but we'll be making it fully open in the near future. @@ -58,7 +58,7 @@ Using unfinished software to build an app that will be seen by millions of peopl ## The road to 1.0 -You can see the list of outstanding issues with the 1.0 milestone on our [issue tracker](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0). Alongside that work, we plan to upgrade the documentation and add more [adapters](https://kit.svelte.dev/docs/adapters). +You can see the list of outstanding issues with the 1.0 milestone on our [issue tracker](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0). Alongside that work, we plan to upgrade the documentation and add more [adapters](/docs/kit/adapters). Most importantly though, we need your feedback to help us make the best possible app framework. Try it out, and let us know which pieces are missing. diff --git a/apps/svelte.dev/content/blog/2021-05-01-whats-new-in-svelte-may-2021.md b/apps/svelte.dev/content/blog/2021-05-01-whats-new-in-svelte-may-2021.md index c06ccdd1a1..eb3ebb8ec4 100644 --- a/apps/svelte.dev/content/blog/2021-05-01-whats-new-in-svelte-may-2021.md +++ b/apps/svelte.dev/content/blog/2021-05-01-whats-new-in-svelte-may-2021.md @@ -17,9 +17,9 @@ Last week, Svelte Summit blew us away with a mountain of content! [Check out the - [kit.svelte.dev](https://kit.svelte.dev/) has a fresh new look and the [SvelteKit Demo Site](https://netlify.demo.svelte.dev/) got a fresh set of paint. Check it out by running `npm init svelte@next` - You can now use `@sveltejs/adapter-static` to create a single-page app or SPA by specifying a fallback page ([PR](https://github.com/sveltejs/kit/pull/1181), [Docs](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)) - Disable Server-side Rendering (SSR) app-wide or on a page-by-page basis ([PR](https://github.com/sveltejs/kit/pull/713)) -- Error messages thrown during pre-rendering are now much more informative and readable ([PR](https://github.com/sveltejs/kit/pull/1062), [Docs](https://kit.svelte.dev/docs/layouts#error-pages)) -- Layouts can now be reset to prevent pages from inheriting the root layout. This is useful if you have a specific layout for a page or i18n variation ([PR](https://github.com/sveltejs/kit/pull/1061), [Docs](https://kit.svelte.dev/docs/layouts#resets)) -- `fetch` in SvelteKit code will now use the environment-provided implementation, whenever possible. If `fetch` is unavailable, it will be polyfilled by adapters ([PR](https://github.com/sveltejs/kit/pull/1066), [Docs](https://kit.svelte.dev/docs/loading#input-fetch)) +- Error messages thrown during pre-rendering are now much more informative and readable ([PR](https://github.com/sveltejs/kit/pull/1062), [Docs](/docs/kit/routing#error)) +- Layouts can now be reset to prevent pages from inheriting the root layout. This is useful if you have a specific layout for a page or i18n variation ([PR](https://github.com/sveltejs/kit/pull/1061), [Docs](/docs/kit/advanced-routing#Advanced-layouts-layout)) +- `fetch` in SvelteKit code will now use the environment-provided implementation, whenever possible. If `fetch` is unavailable, it will be polyfilled by adapters ([PR](https://github.com/sveltejs/kit/pull/1066), [Docs](/docs/kit/load#Making-fetch-requests)) ## New in Svelte & Language Tools diff --git a/apps/svelte.dev/content/blog/2021-09-01-whats-new-in-svelte-september-2021.md b/apps/svelte.dev/content/blog/2021-09-01-whats-new-in-svelte-september-2021.md index 59fe081fe5..bf1d388f3b 100644 --- a/apps/svelte.dev/content/blog/2021-09-01-whats-new-in-svelte-september-2021.md +++ b/apps/svelte.dev/content/blog/2021-09-01-whats-new-in-svelte-september-2021.md @@ -29,8 +29,8 @@ The focus this past month was on continuing to iron out any kinks, with well ove - SvelteKit will now detect if a prerendered app is trying to access a query parameter and return an error instead of failing silently ([#2104](https://github.com/sveltejs/kit/pull/2104)) - `adapter-node` now lets you [add the Kit middleware to your own server](https://kit.svelte.dev/faq#integrations) for use with other middleware. You can also [add middleware in dev mode](https://kit.svelte.dev/faq#how-do-i-use-x-with-sveltekit-how-do-i-use-middleware) with more improvements to come in this area -- The new [`sequence` helper lets you chain together multiple `handle` calls](https://kit.svelte.dev/docs/modules#sveltejs-kit-hooks) -- A new [`handleError` hook](https://kit.svelte.dev/docs/hooks#handleerror) gives you the option to send data to an error tracking service, or to customise the formatting before printing the error to the console. +- The new [`sequence` helper lets you chain together multiple `handle` calls](/docs/kit/@sveltejs-kit-hooks) +- A new [`handleError` hook](/docs/kit/hooks#Shared-hooks-handleError) gives you the option to send data to an error tracking service, or to customise the formatting before printing the error to the console. - `adapter-node` can now listen on socket path ([#2048](https://github.com/sveltejs/kit/pull/2048)) To see all updates to SvelteKit, check out the [SvelteKit changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). diff --git a/apps/svelte.dev/content/blog/2022-02-01-whats-new-in-svelte-february-2022.md b/apps/svelte.dev/content/blog/2022-02-01-whats-new-in-svelte-february-2022.md index c5d2503e16..c7517d2b7f 100644 --- a/apps/svelte.dev/content/blog/2022-02-01-whats-new-in-svelte-february-2022.md +++ b/apps/svelte.dev/content/blog/2022-02-01-whats-new-in-svelte-february-2022.md @@ -18,23 +18,23 @@ Let's take a look... ## What's new in SvelteKit -- `inlineStyleThreshold` allows you to specify where inline stylesheets are inserted into the page ([Docs](https://kit.svelte.dev/docs/configuration#inlinestylethreshold), [#2620](https://github.com/sveltejs/kit/pull/2620)) -- `beforeNavigate`/`afterNavigate` lifecycle functions lets you add functionality before or after a page navigation ([Docs](https://kit.svelte.dev/docs/modules#$app-navigation), [#3293](https://github.com/sveltejs/kit/pull/3293)) -- Platform context can now be passed from adapters ([Docs](https://kit.svelte.dev/docs/adapters#supported-environments-platform-specific-context), [#3429](https://github.com/sveltejs/kit/pull/3429)) -- Hooks now have an `ssr` parameter in `resolve` to make it easier to skip SSR, when needed ([Docs](https://kit.svelte.dev/docs/hooks#handle), [#2804](https://github.com/sveltejs/kit/pull/2804)) +- `inlineStyleThreshold` allows you to specify where inline stylesheets are inserted into the page ([Docs](/docs/kit/configuration#inlineStyleThreshold), [#2620](https://github.com/sveltejs/kit/pull/2620)) +- `beforeNavigate`/`afterNavigate` lifecycle functions lets you add functionality before or after a page navigation ([Docs](/docs/kit/$app-navigation), [#3293](https://github.com/sveltejs/kit/pull/3293)) +- Platform context can now be passed from adapters ([Docs](/docs/kit/adapters#Platform-specific-context), [#3429](https://github.com/sveltejs/kit/pull/3429)) +- Hooks now have an `ssr` parameter in `resolve` to make it easier to skip SSR, when needed ([Docs](/docs/kit/hooks#Server-hooks-handle), [#2804](https://github.com/sveltejs/kit/pull/2804)) - `$page.stuff` provides a mechanism for pages to pass data 'upward' to layouts ([Docs](https://kit.svelte.dev/docs/loading#input-stuff), [#3252](https://github.com/sveltejs/kit/pull/3252)) -- Fallthrough routes let you specify where to route when an route can't be loaded ([Docs](https://kit.svelte.dev/docs/routing#advanced-routing-fallthrough-routes), [#3217](https://github.com/sveltejs/kit/pull/3217)) +- Fallthrough routes let you specify where to route when an route can't be loaded ([#3217](https://github.com/sveltejs/kit/pull/3217)) ### New configs -- Content Security Policy (CSP) is now supported for increased security when using inline javascript or stylesheets ([Docs](https://kit.svelte.dev/docs/configuration#csp), [#3499](https://github.com/sveltejs/kit/pull/3499)) -- `kit.routes` config allows you to customise public/private modules during build ([Docs](https://kit.svelte.dev/docs/configuration#routes), [#3576](https://github.com/sveltejs/kit/pull/3576)) -- `prerender.createIndexFiles` config lets you prerender index.html files as their subfolder's name ([Docs](https://kit.svelte.dev/docs/configuration#prerender), [#2632](https://github.com/sveltejs/kit/pull/2632)) +- Content Security Policy (CSP) is now supported for increased security when using inline javascript or stylesheets ([Docs](/docs/kit/configuration#csp), [#3499](https://github.com/sveltejs/kit/pull/3499)) +- `kit.routes` config allows you to customise public/private modules during build ([#3576](https://github.com/sveltejs/kit/pull/3576)) +- `prerender.createIndexFiles` config lets you prerender index.html files as their subfolder's name ([#2632](https://github.com/sveltejs/kit/pull/2632)) - HTTP methods can now be overridden using `kit.methodOverride` ([Docs](https://kit.svelte.dev/docs/routing#endpoints-http-method-overrides), [#2989](https://github.com/sveltejs/kit/pull/2989)) ### Config changes -- `config.kit.hydrate` and `config.kit.router` are now nested under `config.kit.browser` ([Docs](https://kit.svelte.dev/docs/configuration#browser), [3578](https://github.com/sveltejs/kit/pull/3578)) +- `config.kit.hydrate` and `config.kit.router` are now nested under `config.kit.browser` ([3578](https://github.com/sveltejs/kit/pull/3578)) ### Breaking change diff --git a/apps/svelte.dev/content/blog/2022-03-01-whats-new-in-svelte-march-2022.md b/apps/svelte.dev/content/blog/2022-03-01-whats-new-in-svelte-march-2022.md index 449b603889..1f2b88b236 100644 --- a/apps/svelte.dev/content/blog/2022-03-01-whats-new-in-svelte-march-2022.md +++ b/apps/svelte.dev/content/blog/2022-03-01-whats-new-in-svelte-march-2022.md @@ -13,9 +13,9 @@ More on that and other new features and fixes below! ## What's new in SvelteKit -- The docs are now searchable and multipage with type definitions and hoverable code examples - Check them out at [kit.svelte.dev/docs](https://kit.svelte.dev/docs/) -- Page endpoints significantly decrease the boilerplate needed when loading a page ([Issue](https://github.com/sveltejs/kit/issues/3532), [PR](https://github.com/sveltejs/kit/pull/3679), [Docs](https://kit.svelte.dev/docs/routing#endpoints-page-endpoints)) -- Application versioning and update detection support lets you determine what to do when a route fails to load after an app update ([Issue](https://github.com/sveltejs/kit/issues/87), [PR](https://github.com/sveltejs/kit/pull/3412), [Docs](https://kit.svelte.dev/docs/configuration#version)) +- The docs are now searchable and multipage with type definitions and hoverable code examples - Check them out at [svelte.dev/docs/kit](/docs/kit/) +- Page endpoints significantly decrease the boilerplate needed when loading a page ([Issue](https://github.com/sveltejs/kit/issues/3532), [PR](https://github.com/sveltejs/kit/pull/3679), [Docs](/docs/kit/routing#server)) +- Application versioning and update detection support lets you determine what to do when a route fails to load after an app update ([Issue](https://github.com/sveltejs/kit/issues/87), [PR](https://github.com/sveltejs/kit/pull/3412), [Docs](/docs/kit/configuration#version)) - A new option in `npm init svelte@next` will now set up Playwright automatically for testing ([PR](https://github.com/sveltejs/kit/pull/4056)) ### Breaking Changes @@ -24,7 +24,7 @@ More on that and other new features and fixes below! - App-level types now live in the `App` namespace which allows you to type global types like `Stuff` or `Session` ([#3670](https://github.com/sveltejs/kit/pull/3670)) - `JSONString` is now `JSONValue` ([#3683](https://github.com/sveltejs/kit/pull/3683)) - `createIndexFiles` has been removed — it is now controlled by the `trailingSlash` option ([#3801](https://github.com/sveltejs/kit/pull/3801)) -- SvelteKit will no longer exclude root-relative external links from prerendering, which will cause 404s if these URLs are intended to be served by a separate app. Use a custom [`prerender.onError`](https://kit.svelte.dev/docs/configuration#prerender) handler if you need to ignore them ([#3826](https://github.com/sveltejs/kit/pull/3826)) +- SvelteKit will no longer exclude root-relative external links from prerendering, which will cause 404s if these URLs are intended to be served by a separate app. Use a custom [`prerender.onError`](/docs/kit/configuration#prerender) handler if you need to ignore them ([#3826](https://github.com/sveltejs/kit/pull/3826)) ## New in Language Tools diff --git a/apps/svelte.dev/content/blog/2022-04-01-whats-new-in-svelte-april-2022.md b/apps/svelte.dev/content/blog/2022-04-01-whats-new-in-svelte-april-2022.md index 0478f839ff..ec114e4081 100644 --- a/apps/svelte.dev/content/blog/2022-04-01-whats-new-in-svelte-april-2022.md +++ b/apps/svelte.dev/content/blog/2022-04-01-whats-new-in-svelte-april-2022.md @@ -11,15 +11,15 @@ More on that, and what else is new in Svelte, as we dive in... ## What's new in SvelteKit -- Param matchers allow you to check if a url parameter matches before rendering a page - replacing the need for fallthrough routes for this purpose ([Docs](https://kit.svelte.dev/docs/routing#advanced-routing-matching), [#4334](https://github.com/sveltejs/kit/pull/4334)) +- Param matchers allow you to check if a url parameter matches before rendering a page - replacing the need for fallthrough routes for this purpose ([Docs](/docs/kit/advanced-routing#Matching), [#4334](https://github.com/sveltejs/kit/pull/4334)) - Explicit redirects can now be handled directly from endpoints ([#4260](https://github.com/sveltejs/kit/pull/4260)) - `svelte-kit sync` ([#4182](https://github.com/sveltejs/kit/pull/4182)), TypeScript 4.6 ([#4190](https://github.com/sveltejs/kit/pull/4190)) and Vite 2.9 were released - adding non-blocking dependency optimization and experimental CSS source maps in dev mode as well as a number of bug fixes contributed by the SvelteKit team ([#4468](https://github.com/sveltejs/kit/pull/4468)) ### New Config Options -- `outDir` fixes path issues in monorepos and other situations where the desired output directory is outside the project directory ([Docs](https://kit.svelte.dev/docs/configuration#outdir), [#4176](https://github.com/sveltejs/kit/pull/4176)) -- `endpointExtensions` prevents files other than .js and .ts files from being treated as endpoints, unless you specify endpointExtensions ([Docs](https://kit.svelte.dev/docs/configuration#endpointextensions), [#4197](https://github.com/sveltejs/kit/pull/4197)) -- `prerender.default` lets you prerender every page without having to write `export const prerender = true` in every page file ([Docs](https://kit.svelte.dev/docs/configuration#prerender), [#4192](https://github.com/sveltejs/kit/pull/4192)) +- `outDir` fixes path issues in monorepos and other situations where the desired output directory is outside the project directory ([Docs](/docs/kit/configuration#outDir), [#4176](https://github.com/sveltejs/kit/pull/4176)) +- `endpointExtensions` prevents files other than .js and .ts files from being treated as endpoints, unless you specify `endpointExtensions` ([Docs](https://kit.svelte.dev/docs/configuration#endpointextensions), [#4197](https://github.com/sveltejs/kit/pull/4197)) +- `prerender.default` lets you prerender every page without having to write `export const prerender = true` in every page file ([Docs](/docs/kit/configuration#prerender), [#4192](https://github.com/sveltejs/kit/pull/4192)) ### Breaking Changes diff --git a/apps/svelte.dev/content/blog/2022-05-01-whats-new-in-svelte-may-2022.md b/apps/svelte.dev/content/blog/2022-05-01-whats-new-in-svelte-may-2022.md index 0408f526dd..179e6aa658 100644 --- a/apps/svelte.dev/content/blog/2022-05-01-whats-new-in-svelte-may-2022.md +++ b/apps/svelte.dev/content/blog/2022-05-01-whats-new-in-svelte-may-2022.md @@ -23,12 +23,12 @@ With yesterday's Svelte Summit behind us, we've got a lot of news to share! Chec - Files and directories can now be named `__tests__` and `__test__` in the routes directory ([#4438](https://github.com/sveltejs/kit/pull/4438)) - Netlify Edge Functions ([#4657](https://github.com/sveltejs/kit/pull/4657)) and the Vercel build output API ([#4663](https://github.com/sveltejs/kit/pull/4663)) are now supported -- Custom `load` dependencies, array of strings representing URLs the page depends on, are now available when loading routes ([Docs](https://kit.svelte.dev/docs/loading#output-dependencies), [#4536](https://github.com/sveltejs/kit/pull/4536)) +- Custom `load` dependencies, array of strings representing URLs the page depends on, are now available when loading routes ([Docs](/docs/kit/load#Rerunning-load-functions), [#4536](https://github.com/sveltejs/kit/pull/4536)) ### Breaking Changes -- Validators are now called "matchers" ([Docs](https://kit.svelte.dev/docs/routing#advanced-routing-matching), [#4358](https://github.com/sveltejs/kit/pull/4358)) -- `__layout.reset` has been replaced by named layouts - which have much configurability for shared layout elements ([Docs](https://kit.svelte.dev/docs/layouts#named-layouts), [#4388](https://github.com/sveltejs/kit/pull/4388)) +- Validators are now called "matchers" ([Docs](/docs/kit/advanced-routing#Matching), [#4358](https://github.com/sveltejs/kit/pull/4358)) +- `__layout.reset` has been replaced by named layouts - which have much configurability for shared layout elements ([Docs](/docs/kit/advanced-routing#Advanced-layouts-layout), [#4388](https://github.com/sveltejs/kit/pull/4388)) - Prerendering is now skipped for `rel="external"` links ([#4545](https://github.com/sveltejs/kit/pull/4545)) - `maxage` is now `cache` in `LoadOutput` ([#4690](https://github.com/sveltejs/kit/pull/4690)) diff --git a/apps/svelte.dev/content/blog/2022-06-01-whats-new-in-svelte-june-2022.md b/apps/svelte.dev/content/blog/2022-06-01-whats-new-in-svelte-june-2022.md index 6c0c248759..b78a7ad962 100644 --- a/apps/svelte.dev/content/blog/2022-06-01-whats-new-in-svelte-june-2022.md +++ b/apps/svelte.dev/content/blog/2022-06-01-whats-new-in-svelte-june-2022.md @@ -18,16 +18,16 @@ Let's dive in! ## What's new in SvelteKit - Vite 2.9.9 was released as one of the last Vite 2 releases. The Svelte team has been hard at work contributing to the Vite 3 release to make the integration between SvelteKit and Vite smoother than ever ([Vite 3.0 Milestone](https://github.com/vitejs/vite/milestone/5)) -- `config.kit.alias` lets you more easily declare a custom alias to replace values in `import` statements ([Docs](https://kit.svelte.dev/docs/configuration#alias), [PR](https://github.com/sveltejs/kit/pull/4964)) +- `config.kit.alias` lets you more easily declare a custom alias to replace values in `import` statements ([Docs](/docs/kit/configuration#alias), [PR](https://github.com/sveltejs/kit/pull/4964)) - Pages marked for prerendering will now fail during SSR at runtime ([PR](https://github.com/sveltejs/kit/pull/4812)) ### Breaking Changes - Node 14 is no longer supported ([PR](https://github.com/sveltejs/kit/pull/4922)) - Requests to `/favicon.ico` will no longer be suppressed and will instead be handled as a valid route ([PR](https://github.com/sveltejs/kit/pull/5046)) -- AMP support has been moved to a separate `@sveltejs/amp` package ([Docs](https://kit.svelte.dev/docs/seo#manual-setup-amp), [PR](https://github.com/sveltejs/kit/pull/4710)) +- AMP support has been moved to a separate `@sveltejs/amp` package ([Docs](/docs/kit/seo#Manual-setup-AMP), [PR](https://github.com/sveltejs/kit/pull/4710)) - Generated types are now written to `_types` directories - update your imports accordingly ([PR](https://github.com/sveltejs/kit/pull/4705)) -- `%svelte.head%` and `%svelte.body%` are now `%sveltekit.head%` and `%sveltekit.body%` in `app.html` ([Docs](https://kit.svelte.dev/docs/migrating#project-files-src-template-html), [PR](https://github.com/sveltejs/kit/pull/5016/)) +- `%svelte.head%` and `%svelte.body%` are now `%sveltekit.head%` and `%sveltekit.body%` in `app.html` ([PR](https://github.com/sveltejs/kit/pull/5016/)) - `LoadInput` is now `LoadEvent` - Dropped support for Wrangler 1 in favor of Wrangler 2 ([PR](https://github.com/sveltejs/kit/pull/4887)) diff --git a/apps/svelte.dev/content/blog/2022-08-01-whats-new-in-svelte-august-2022.md b/apps/svelte.dev/content/blog/2022-08-01-whats-new-in-svelte-august-2022.md index 23876c3216..38ed364486 100644 --- a/apps/svelte.dev/content/blog/2022-08-01-whats-new-in-svelte-august-2022.md +++ b/apps/svelte.dev/content/blog/2022-08-01-whats-new-in-svelte-august-2022.md @@ -18,20 +18,20 @@ Now onto the rest of the updates... - Lots of improvements to error handling ([#4665](https://github.com/sveltejs/kit/pull/4665), [#5622](https://github.com/sveltejs/kit/pull/5622), [#5619](https://github.com/sveltejs/kit/pull/5619), [#5616](https://github.com/sveltejs/kit/pull/5616)) - Custom Vite modes are now respected in SSR builds ([#5602](https://github.com/sveltejs/kit/pull/5602)) - Custom Vite config locations are now supported ([#5705](https://github.com/sveltejs/kit/pull/5705)) -- Private environment variables (aka "secrets") are now much more secure. Now if you accidentally import them to client-side code, you'll see an error ([#5663](https://github.com/sveltejs/kit/pull/5663), [Docs](https://kit.svelte.dev/docs/configuration#env)) +- Private environment variables (aka "secrets") are now much more secure. Now if you accidentally import them to client-side code, you'll see an error ([#5663](https://github.com/sveltejs/kit/pull/5663), [Docs](/docs/kit/configuration#env)) - Vercel's v3 build output API is now being used in `adapter-vercel` ([#5514](https://github.com/sveltejs/kit/pull/5514)) - `vite-plugin-svelte` has reached 1.0 and now supports Vite 3. You'll notice new default ports for `dev` (port 5173) and `preview` (port 4173) ([#5005](https://github.com/sveltejs/kit/pull/5005), [vite-plugin-svelte CHANGELOG](https://github.com/sveltejs/vite-plugin-svelte/blob/main/packages/vite-plugin-svelte/CHANGELOG.md)) ### Breaking changes: - `mode`, `prod` and `server` are no longer available in `$app/env` ([#5602](https://github.com/sveltejs/kit/pull/5602)) -- `svelte-kit` CLI commands are now run using the `vite` command and `vite.config.js` is required. This will allow first-class support with other projects in the Vite ecosystem like Vitest and Storybook ([#5332](https://github.com/sveltejs/kit/pull/5332), [Docs](https://kit.svelte.dev/docs/project-structure#project-files-vite-config-js)) -- `endpointExtensions` is now `moduleExtensions` and can be used to filter param matchers ([#5085](https://github.com/sveltejs/kit/pull/5085), [Docs](https://kit.svelte.dev/docs/configuration#moduleextensions)) +- `svelte-kit` CLI commands are now run using the `vite` command and `vite.config.js` is required. This will allow first-class support with other projects in the Vite ecosystem like Vitest and Storybook ([#5332](https://github.com/sveltejs/kit/pull/5332), [Docs](/docs/kit/project-structure#Project-files-vite.config.js)) +- `endpointExtensions` is now `moduleExtensions` and can be used to filter param matchers ([#5085](https://github.com/sveltejs/kit/pull/5085), [Docs](/docs/kit/configuration#moduleExtensions)) - Node 16.9 is now the minimum version for SvelteKit ([#5395](https://github.com/sveltejs/kit/pull/5395)) - %-encoded filenames are now allowed. If you had a `%` in your route, you must now encode it with `%25` ([#5056](https://github.com/sveltejs/kit/pull/5056)) -- Endpoint method names are now uppercased to match HTTP specifications ([#5513](https://github.com/sveltejs/kit/pull/5513), [Docs](https://kit.svelte.dev/docs/routing#endpoints)) +- Endpoint method names are now uppercased to match HTTP specifications ([#5513](https://github.com/sveltejs/kit/pull/5513), [Docs](/docs/kit/routing#server)) - `writeStatic` has been removed to align with Vite's config ([#5618](https://github.com/sveltejs/kit/pull/5618)) -- `transformPage` is now `transformPageChunk` ([#5657](https://github.com/sveltejs/kit/pull/5657), [Docs](https://kit.svelte.dev/docs/hooks#handle)) +- `transformPage` is now `transformPageChunk` ([#5657](https://github.com/sveltejs/kit/pull/5657), [Docs](/docs/kit/hooks#Server-hooks-handle)) - The `prepare` script is no longer needed in `package.json` ([#5760](https://github.com/sveltejs/kit/pull/5760)) - `adapter-node` no longer does any compression while we wait for a [bug fix in the `compression` library](https://github.com/expressjs/compression/pull/183) ([#5560](https://github.com/sveltejs/kit/pull/5506)) diff --git a/apps/svelte.dev/content/blog/2022-09-01-whats-new-in-svelte-september-2022.md b/apps/svelte.dev/content/blog/2022-09-01-whats-new-in-svelte-september-2022.md index ca1f20caec..7ff272f3f8 100644 --- a/apps/svelte.dev/content/blog/2022-09-01-whats-new-in-svelte-september-2022.md +++ b/apps/svelte.dev/content/blog/2022-09-01-whats-new-in-svelte-september-2022.md @@ -22,7 +22,7 @@ But the new routing isn't the only new feature in SvelteKit... - The filesystem-based router and `load` API improves the way routes are managed. **Before installing version `@sveltejs/kit@1.0.0-next.406` or later, [follow this migration guide](https://github.com/sveltejs/kit/discussions/5774)** ([PR](https://github.com/sveltejs/kit/pull/5778), [Issue](https://github.com/sveltejs/kit/discussions/5748)) - `event.session` has been removed from `load` along with the `session` store and `getSession`. Use `event.locals` instead (**1.0.0-next.415**, [PR](https://github.com/sveltejs/kit/pull/5946)) -- Named layouts have been removed in favor of `(groups)` (**1.0.0-next.432**, [Docs](https://kit.svelte.dev/docs/advanced-routing#advanced-layouts), [PR & Migration Instructions](https://github.com/sveltejs/kit/pull/6174)) +- Named layouts have been removed in favor of `(groups)` (**1.0.0-next.432**, [Docs](/docs/kit/advanced-routing#Advanced-layouts), [PR & Migration Instructions](https://github.com/sveltejs/kit/pull/6174)) - `event.clientAddress` is now `event.getClientAddress()` (**1.0.0-next.438**, [PR](https://github.com/sveltejs/kit/pull/6237)) - `$app/env` has been renamed to `$app/environment`, to disambiguate with `$env/...` (**1.0.0-next.445**, [PR](https://github.com/sveltejs/kit/pull/6334)) diff --git a/apps/svelte.dev/content/blog/2022-10-01-whats-new-in-svelte-october-2022.md b/apps/svelte.dev/content/blog/2022-10-01-whats-new-in-svelte-october-2022.md index 6505bff71a..dd4fe72a1f 100644 --- a/apps/svelte.dev/content/blog/2022-10-01-whats-new-in-svelte-october-2022.md +++ b/apps/svelte.dev/content/blog/2022-10-01-whats-new-in-svelte-october-2022.md @@ -39,7 +39,7 @@ _Day Two_ ## More SvelteKit Updates -- `use:enhance` is the easiest way to progressively enhance a form ([Docs](https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance), [#6633](https://github.com/sveltejs/kit/pull/6633), [#6828](https://github.com/sveltejs/kit/pull/6828), [#7012](https://github.com/sveltejs/kit/pull/7012)) +- `use:enhance` is the easiest way to progressively enhance a form ([Docs](/docs/kit/form-actions#Progressive-enhancement-use:enhance), [#6633](https://github.com/sveltejs/kit/pull/6633), [#6828](https://github.com/sveltejs/kit/pull/6828), [#7012](https://github.com/sveltejs/kit/pull/7012)) - The demo app has been updated to add the Sverdle game, which Rich demoed at Svelte Summit and demonstrates `use:enhance` ([#6979](https://github.com/sveltejs/kit/pull/6979)) - Cloudflare Pages `_routes.json` specification is now supported by `adapter-cloudflare` ([#6530](https://github.com/sveltejs/kit/pull/6530)) - Improved build performance by running asset and page compression in parallel ([#6710](https://github.com/sveltejs/kit/pull/6710)) @@ -49,7 +49,7 @@ _Day Two_ - Node 16.14 is now the minimum version to run SvelteKit ([#6388](https://github.com/sveltejs/kit/pull/6388)) - `App.PrivateEnv` and `App.PublicEnv` have been removed in favour of generated types ([#6413](https://github.com/sveltejs/kit/pull/6413)) - `%sveltekit.message%` has been replaced with `%sveltekit.error.message%` ([6659](https://github.com/sveltejs/kit/pull/6659)) -- `App.PageError` is now `App.Error` - check for it in your hooks ([Docs](https://kit.svelte.dev/docs/hooks#shared-hooks-handleerror), [#6963](https://github.com/sveltejs/kit/pull/6963)) +- `App.PageError` is now `App.Error` - check for it in your hooks ([Docs](/docs/kit/hooks#Shared-hooks-handleError), [#6963](https://github.com/sveltejs/kit/pull/6963)) - `externalFetch` is now `handleFetch` and will run for all fetch calls in `load` that run on the server ([#6565](https://github.com/sveltejs/kit/pull/6565)) For a full list of changes, check out SvelteKit's [CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). diff --git a/apps/svelte.dev/content/blog/2022-11-01-whats-new-in-svelte-november-2022.md b/apps/svelte.dev/content/blog/2022-11-01-whats-new-in-svelte-november-2022.md index 44db8f84d2..1bae198e78 100644 --- a/apps/svelte.dev/content/blog/2022-11-01-whats-new-in-svelte-november-2022.md +++ b/apps/svelte.dev/content/blog/2022-11-01-whats-new-in-svelte-november-2022.md @@ -11,9 +11,9 @@ There's also a _huge_ showcase to cover... so let's jump in! ## What's new in SvelteKit -- The new `update` method for `use:enhance` lets you easily get back the default form behavior while augmenting it with your own logic ([docs](https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance), [#7083](https://github.com/sveltejs/kit/pull/7083) and [#7326](https://github.com/sveltejs/kit/pull/7326)) -- `[[optional]]` parameters are now available for routing ([docs](https://kit.svelte.dev/docs/advanced-routing#optional-parameters), [#7051](https://github.com/sveltejs/kit/pull/7051)) -- `goto` now has `invalidateAll` to (re-)run all `load` functions belonging to the new active page ([docs](https://kit.svelte.dev/docs/$app-navigation#goto), [#7407](https://github.com/sveltejs/kit/pull/7407)) +- The new `update` method for `use:enhance` lets you easily get back the default form behavior while augmenting it with your own logic ([docs](/docs/kit/form-actions#Progressive-enhancement-use:enhance), [#7083](https://github.com/sveltejs/kit/pull/7083) and [#7326](https://github.com/sveltejs/kit/pull/7326)) +- `[[optional]]` parameters are now available for routing ([docs](/docs/kit/advanced-routing#Optional-parameters), [#7051](https://github.com/sveltejs/kit/pull/7051)) +- `goto` now has `invalidateAll` to (re-)run all `load` functions belonging to the new active page ([docs](/docs/kit/$app-navigation#goto), [#7407](https://github.com/sveltejs/kit/pull/7407)) - `config.kit.paths.base` is now used in adapters looking for static assets - fixing 404 issues across `adapter-netlify`, `adapter-vercel`, `adapter-cloudflare`, and `adapter-cloudflare-workers` ([#4448](https://github.com/sveltejs/kit/pull/4448)) ### Breaking changes: diff --git a/apps/svelte.dev/content/blog/2022-12-01-whats-new-in-svelte-december-2022.md b/apps/svelte.dev/content/blog/2022-12-01-whats-new-in-svelte-december-2022.md index 71e07ca4ad..0d122eab9f 100644 --- a/apps/svelte.dev/content/blog/2022-12-01-whats-new-in-svelte-december-2022.md +++ b/apps/svelte.dev/content/blog/2022-12-01-whats-new-in-svelte-december-2022.md @@ -16,7 +16,7 @@ Let's get to it! - Linking to `` tags is now supported ([#7596](https://github.com/sveltejs/kit/pull/7596)) - Throwing redirects in the `handle` hook is now supported ([#7612](https://github.com/sveltejs/kit/pull/7612)) - A fallback component will now be added automatically for layouts without one ([#7619](https://github.com/sveltejs/kit/pull/7619)) -- The new `preload` function within the `resolve` hook determines what files should be added to the tag to preload it ([Docs](https://kit.svelte.dev/docs/hooks#server-hooks-handle), [#4963](https://github.com/sveltejs/kit/pull/4963), [#7704](https://github.com/sveltejs/kit/pull/7704)) +- The new `preload` function within the `resolve` hook determines what files should be added to the tag to preload it ([Docs](/docs/kit/hooks#Server-hooks-handle), [#4963](https://github.com/sveltejs/kit/pull/4963), [#7704](https://github.com/sveltejs/kit/pull/7704)) - `version` is now available via `$app/environment` ([#7689](https://github.com/sveltejs/kit/pull/7689), [#7694](https://github.com/sveltejs/kit/pull/7694)) - `handleError` can now return a promise ([#7780](https://github.com/sveltejs/kit/pull/7780)) diff --git a/apps/svelte.dev/content/blog/2022-12-14-announcing-sveltekit-1.0.md b/apps/svelte.dev/content/blog/2022-12-14-announcing-sveltekit-1.0.md index 0b8f081ef7..3fd84120a8 100644 --- a/apps/svelte.dev/content/blog/2022-12-14-announcing-sveltekit-1.0.md +++ b/apps/svelte.dev/content/blog/2022-12-14-announcing-sveltekit-1.0.md @@ -9,7 +9,7 @@ After two years in development, [SvelteKit](https://kit.svelte.dev) has finally We’re so excited to share this release with you. It’s the culmination of thousands of hours of work, both from the Svelte core team and the wider community, and we think it’s the most enjoyable way to build production-grade websites, whether you’re a solo developer working on a small project or part of a large team. -To get started, run `npm create svelte@latest`, and visit the [docs](https://kit.svelte.dev/docs) and (experimental!) [interactive tutorial](https://learn.svelte.dev). +To get started, run `npm create svelte@latest`, and visit the [docs](/docs/kit) and (experimental!) [interactive tutorial](https://learn.svelte.dev).
@@ -70,7 +70,7 @@ And of course you have access to everything [npm](https://npmjs.com/) has to off Anywhere! The SvelteKit CLI needs Node.js installed locally, but the framework itself has no dependencies on any platform. This means you can deploy it wherever JavaScript runs. -This is made possible by [adapters](https://kit.svelte.dev/docs/adapters). The default adapter, [adapter-auto](https://github.com/sveltejs/kit/tree/master/packages/adapter-auto), provides zero-config support for Vercel, Netlify, Cloudflare Pages and Azure Static Web Apps, with more platforms coming in the future. Community-provided adapters add support for Deno, Bun, Firebase, App Engine, AWS Lambda and many others. +This is made possible by [adapters](/docs/kit/adapters). The default adapter, [adapter-auto](https://github.com/sveltejs/kit/tree/master/packages/adapter-auto), provides zero-config support for Vercel, Netlify, Cloudflare Pages and Azure Static Web Apps, with more platforms coming in the future. Community-provided adapters add support for Deno, Bun, Firebase, App Engine, AWS Lambda and many others. You can also deploy your app as a Node.js server using [adapter-node](https://github.com/sveltejs/kit/tree/master/packages/adapter-node). diff --git a/apps/svelte.dev/content/blog/2023-01-01-whats-new-in-svelte-january-2023.md b/apps/svelte.dev/content/blog/2023-01-01-whats-new-in-svelte-january-2023.md index 401bf0516b..f2572d9e02 100644 --- a/apps/svelte.dev/content/blog/2023-01-01-whats-new-in-svelte-january-2023.md +++ b/apps/svelte.dev/content/blog/2023-01-01-whats-new-in-svelte-january-2023.md @@ -13,14 +13,14 @@ Let's dive into the details... - `@sveltejs/kit` 1.0 is out! All future releases will follow semver and changes will be listed as major/minor/patch in the [CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md#100). - Improved support for Storybook and Histoire ([#7990](https://github.com/sveltejs/kit/pull/7990)). Work is ongoing to fully support those tools ([storybook#20239](https://github.com/storybookjs/storybook/pull/20239)). -- `vitePreprocess` is now the default preprocessor. Please see [the docs](https://kit.svelte.dev/docs/integrations#preprocessors) for differences between `vitePreprocess` and `svelte-preprocess` ([#8036](https://github.com/sveltejs/kit/pull/8036)). +- `vitePreprocess` is now the default preprocessor. Please see [the docs](/docs/kit/integrations#vitePreprocess) for differences between `vitePreprocess` and `svelte-preprocess` ([#8036](https://github.com/sveltejs/kit/pull/8036)). ### Breaking changes: - Unknown exports (except when starting with an underscore) are no longer allowed from `+(layout|page)(.server)?.js` and `+server.js` files ([#7878](https://github.com/sveltejs/kit/pull/7878)) - `__data.json` is now stripped from URL ([#7979](https://github.com/sveltejs/kit/pull/7979)) - `sveltekit()` will now return a promise for an array of Vite plugins ([#7994](https://github.com/sveltejs/kit/pull/7994)) -- A new `embedded` option, turned off by default, helps with link clicks when embedding SvelteKit ([docs](https://kit.svelte.dev/docs/configuration), [#7969](https://github.com/sveltejs/kit/pull/7969)) +- A new `embedded` option, turned off by default, helps with link clicks when embedding SvelteKit ([docs](/docs/kit/configuration), [#7969](https://github.com/sveltejs/kit/pull/7969)) - Automatic fallback generation has been replaced with `builder.generateFallback(fallback)` ([#8013](https://github.com/sveltejs/kit/pull/8013)) - `invalid()` is now `fail()` and `ValidationError` is now `ActionFailure` ([#8012](https://github.com/sveltejs/kit/pull/8012)) - SvelteKit will now throw an error on invalid load response ([#8003](https://github.com/sveltejs/kit/pull/8003)) diff --git a/apps/svelte.dev/content/blog/2023-02-01-whats-new-in-svelte-february-2023.md b/apps/svelte.dev/content/blog/2023-02-01-whats-new-in-svelte-february-2023.md index 04d789c0ed..825fdfef31 100644 --- a/apps/svelte.dev/content/blog/2023-02-01-whats-new-in-svelte-february-2023.md +++ b/apps/svelte.dev/content/blog/2023-02-01-whats-new-in-svelte-february-2023.md @@ -20,7 +20,7 @@ Work in the Svelte ecosystem this month has been focused on SvelteKit bug fixes - A warning will now indicated that hydration may break if comments are removed from HTML (**1.0.11**, [#8423](https://github.com/sveltejs/kit/pull/8423)) - A warning will occur when of page options are used in `.svelte` files or a missing `` in layout is detected (**1.1.0**, [#8475](https://github.com/sveltejs/kit/pull/8475)) - The new `text(...)` helper makes it easy to generate text responses (**1.2.0**, [#8371](https://github.com/sveltejs/kit/pull/8371)) -- The public env can now be accessed within app.html (**1.2.0**, [Docs](https://kit.svelte.dev/docs/project-structure#project-files-src), [#8449](https://github.com/sveltejs/kit/pull/8449)) +- The public env can now be accessed within app.html (**1.2.0**, [Docs](/docs/kit/project-structure#Project-files-src), [#8449](https://github.com/sveltejs/kit/pull/8449)) - An error will now be thrown if cookie exceeds size limit (**1.2.1**, [#8591](https://github.com/sveltejs/kit/pull/8591)) - The generated `tsconfig` can now be modified (**1.3.0**, [#8606](https://github.com/sveltejs/kit/pull/8606)) diff --git a/apps/svelte.dev/content/blog/2023-02-21-streaming-snapshots-sveltekit.md b/apps/svelte.dev/content/blog/2023-02-21-streaming-snapshots-sveltekit.md index b421bd1cc5..5d4089a01c 100644 --- a/apps/svelte.dev/content/blog/2023-02-21-streaming-snapshots-sveltekit.md +++ b/apps/svelte.dev/content/blog/2023-02-21-streaming-snapshots-sveltekit.md @@ -5,11 +5,11 @@ author: Geoff Rich, Rich Harris authorURL: https://geoffrich.net, https://twitter.com/Rich_Harris --- -The Svelte team has been hard at work since the release of SvelteKit 1.0. Let’s talk about some of the major new features that have shipped since launch: [streaming non-essential data](https://kit.svelte.dev/docs/load#streaming-with-promises), [snapshots](https://kit.svelte.dev/docs/snapshots), and [route-level config](https://kit.svelte.dev/docs/page-options#config). +The Svelte team has been hard at work since the release of SvelteKit 1.0. Let’s talk about some of the major new features that have shipped since launch: [streaming non-essential data](/docs/kit/load#Streaming-with-promises), [snapshots](/docs/kit/snapshots), and [route-level config](/docs/kit/page-options#config). ## Stream non-essential data in load functions -SvelteKit uses [load functions](https://kit.svelte.dev/docs/load) to retrieve data for a given route. When navigating between pages, it first fetches the data, and then renders the page with the result. This could be a problem if some of the data for the page takes longer to load than others, especially if the data isn’t essential – the user won’t see any part of the new page until all the data is ready. +SvelteKit uses [load functions](/docs/kit/load) to retrieve data for a given route. When navigating between pages, it first fetches the data, and then renders the page with the result. This could be a problem if some of the data for the page takes longer to load than others, especially if the data isn’t essential – the user won’t see any part of the new page until all the data is ready. There were ways to work around this. In particular, you could fetch the slow data in the component itself, so it first renders with the data from `load` and then starts fetching the slow data. But this was not ideal: the data is even more delayed since you don’t start fetching until the client renders, and you’re also having to break SvelteKit’s `load` convention. @@ -121,7 +121,7 @@ Because promises are natively supported in this way, you can put them anywhere i One caveat: this feature needs JavaScript. Because of this, we recommend that you only stream in non-essential data so that the core of the experience is available to all users. -For more on this feature, see [the documentation](https://kit.svelte.dev/docs/load#streaming-with-promises). You can see a demo at [sveltekit-on-the-edge.vercel.app](https://sveltekit-on-the-edge.vercel.app/edge) (the location data is artificially delayed and streamed in) or [deploy your own on Vercel](https://vercel.com/templates/svelte/sveltekit-edge-functions), where streaming is supported in both Edge Functions and Serverless Functions. +For more on this feature, see [the documentation](/docs/kit/load#Streaming-with-promises). You can see a demo at [sveltekit-on-the-edge.vercel.app](https://sveltekit-on-the-edge.vercel.app/edge) (the location data is artificially delayed and streamed in) or [deploy your own on Vercel](https://vercel.com/templates/svelte/sveltekit-edge-functions), where streaming is supported in both Edge Functions and Serverless Functions. We're grateful for the inspiration from prior implementations of this idea including Qwik, Remix, Solid, Marko, React and many others. @@ -154,11 +154,11 @@ For example, here is how you would capture and restore the value of a textarea: While things like form input values and scroll positions are common examples, you can store any JSON-serializable data you like in a snapshot. The snapshot data is stored in [sessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage), so it will persist even when the page is reloaded, or if the user navigates to a different site entirely. Because it’s in `sessionStorage`, you won’t be able to access it during server-side rendering. -For more, see [the documentation](https://kit.svelte.dev/docs/snapshots). +For more, see [the documentation](/docs/kit/snapshots). ## Route-level deployment configuration -SvelteKit uses platform-specific [adapters](https://kit.svelte.dev/docs/adapters) to transform your app code for deployment to production. Until now, you had to configure your deployment on an app-wide level. For instance, you could either deploy your app as an edge function or a serverless function, but not both. This made it impossible to take advantage of the edge for parts of your app – if any route needed Node APIs, then you couldn’t deploy any of it to the edge. The same is true for other aspects of deployment configuration, such as regions and allocated memory: you had to choose one value that applied to every route in your entire app. +SvelteKit uses platform-specific [adapters](/docs/kit/adapters) to transform your app code for deployment to production. Until now, you had to configure your deployment on an app-wide level. For instance, you could either deploy your app as an edge function or a serverless function, but not both. This made it impossible to take advantage of the edge for parts of your app – if any route needed Node APIs, then you couldn’t deploy any of it to the edge. The same is true for other aspects of deployment configuration, such as regions and allocated memory: you had to choose one value that applied to every route in your entire app. Now, you can export a `config` object in your `+server.js`, `+page(.server).js` and `+layout(.server).js` files to control how those routes are deployed. Doing so in a `+layout.js` will apply the configuration to all child pages. The type of `config` is unique to each adapter, since it depends on the environment you’re deploying to. @@ -171,7 +171,7 @@ export const config: Config = { }; ``` -Configs are merged at the top level, so you can override values set in a layout for pages further down the tree. For more details, see [the documentation](https://kit.svelte.dev/docs/page-options#config). +Configs are merged at the top level, so you can override values set in a layout for pages further down the tree. For more details, see [the documentation](/docs/kit/page-options#config). If you deploy to Vercel, you can take advantage of this feature by installing the latest versions of SvelteKit and your adapter. This will require a major upgrade to your adapter version, since adapters supporting route-level config require SvelteKit 1.5 or later. @@ -180,11 +180,11 @@ npm i @sveltejs/kit@latest npm i @sveltejs/adapter-auto@latest # or @sveltejs/adapter-vercel@latest ``` -For now, only the [Vercel adapter](https://kit.svelte.dev/docs/adapter-vercel#deployment-configuration) implements route-specific config, but the building blocks are there to implement this for other platforms. If you’re an adapter author, see the changes in [the PR](https://github.com/sveltejs/kit/pull/8740) to see what is required. +For now, only the [Vercel adapter](/docs/kit/adapter-vercel#Deployment-configuration) implements route-specific config, but the building blocks are there to implement this for other platforms. If you’re an adapter author, see the changes in [the PR](https://github.com/sveltejs/kit/pull/8740) to see what is required. ## Incremental static regeneration on Vercel -Route-level config also unlocked another much-requested feature – you can now use [incremental static regeneration](https://kit.svelte.dev/docs/adapter-vercel#incremental-static-regeneration) (ISR) with SvelteKit apps deployed to Vercel. ISR provides the performance and cost advantages of prerendered content with the flexibility of dynamically rendered content. +Route-level config also unlocked another much-requested feature – you can now use [incremental static regeneration](/docs/kit/adapter-vercel#Incremental-Static-Regeneration) (ISR) with SvelteKit apps deployed to Vercel. ISR provides the performance and cost advantages of prerendered content with the flexibility of dynamically rendered content. To add ISR to a route, include the `isr` property in your `config` object: @@ -198,10 +198,10 @@ export const config = { ## And much more... -- The [OPTIONS method](https://kit.svelte.dev/docs/routing#server) is now supported in `+server.js` files +- The [OPTIONS method](/docs/kit/routing#server) is now supported in `+server.js` files - Better error messages when you [export something that belongs in a different file](https://github.com/sveltejs/kit/pull/9055) or [forget to put a slot](https://github.com/sveltejs/kit/pull/8475) in your +layout.svelte. -- You can now [access public environment variables in app.html](https://kit.svelte.dev/docs/project-structure#project-files-src) -- A new [text helper](https://kit.svelte.dev/docs/modules#sveltejs-kit-text) for creating responses +- You can now [access public environment variables in app.html](/docs/kit/project-structure#Project-files-src) +- A new [text helper](/docs/kit/@sveltejs-kit#text) for creating responses - And a ton of bug fixes – see [the changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md) for the full release notes. Thank you to everyone who has contributed and uses SvelteKit in their projects. We’ve said it before, but Svelte is a community project, and it wouldn’t be possible without your feedback and contributions. diff --git a/apps/svelte.dev/content/blog/2023-03-01-whats-new-in-svelte-march-2023.md b/apps/svelte.dev/content/blog/2023-03-01-whats-new-in-svelte-march-2023.md index d18068e44a..33c0b0ae50 100644 --- a/apps/svelte.dev/content/blog/2023-03-01-whats-new-in-svelte-march-2023.md +++ b/apps/svelte.dev/content/blog/2023-03-01-whats-new-in-svelte-march-2023.md @@ -16,13 +16,13 @@ Now let's jump into this month's changes... ## What's new in SvelteKit - `$app/paths` can now be used without an app - making things like component testing with Vitest, using Storybook, etc. easier (**1.4.0**, [#8838](https://github.com/sveltejs/kit/pull/8838)) -- Adapters can now be configured at the route level (**1.5.0**, [Docs](https://kit.svelte.dev/docs/page-options#config), [#8740](https://github.com/sveltejs/kit/pull/8740)) -- The new snapshot mechanism preserves ephemeral DOM state even after navigation and page reloads (**1.5.0**,[Docs](https://kit.svelte.dev/docs/snapshots), [#8710](https://github.com/sveltejs/kit/pull/8710)) -- `OPTIONS` are now available within the server method (**1.6.0**, [Docs](https://kit.svelte.dev/docs/routing#server), [#8731](https://github.com/sveltejs/kit/pull/8731)) +- Adapters can now be configured at the route level (**1.5.0**, [Docs](/docs/kit/page-options#config), [#8740](https://github.com/sveltejs/kit/pull/8740)) +- The new snapshot mechanism preserves ephemeral DOM state even after navigation and page reloads (**1.5.0**,[Docs](/docs/kit/snapshots), [#8710](https://github.com/sveltejs/kit/pull/8710)) +- `OPTIONS` are now available within the server method (**1.6.0**, [Docs](/docs/kit/routing#server), [#8731](https://github.com/sveltejs/kit/pull/8731)) - Richer error messages have been added for invalid exports (**1.7.0**, [#9055](https://github.com/sveltejs/kit/pull/9055)) -- Streaming promises are now available for server load functions (**1.8.0**, [Docs](https://kit.svelte.dev/docs/load#streaming-with-promises), [#8901](https://github.com/sveltejs/kit/pull/8901)) -- A new configuration option, `preloadStrategy`, helps tune preloading to avoid import 'waterfalls' on certain browsers (**1.8.4**, [Docs](https://kit.svelte.dev/docs/configuration#output), [#9179](https://github.com/sveltejs/kit/pull/9179)) -- The new `paths.relative` option can control interpretation of `paths.assets` and `paths.base` (**1.9.0**, [Docs](https://kit.svelte.dev/docs/configuration#paths), [#9220](https://github.com/sveltejs/kit/pull/9220)) +- Streaming promises are now available for server load functions (**1.8.0**, [Docs](/docs/kit/load#Streaming-with-promises), [#8901](https://github.com/sveltejs/kit/pull/8901)) +- A new configuration option, `preloadStrategy`, helps tune preloading to avoid import 'waterfalls' on certain browsers (**1.8.4**, [Docs](/docs/kit/configuration#output), [#9179](https://github.com/sveltejs/kit/pull/9179)) +- The new `paths.relative` option can control interpretation of `paths.assets` and `paths.base` (**1.9.0**, [Docs](/docs/kit/configuration#paths), [#9220](https://github.com/sveltejs/kit/pull/9220)) ## What's new in Svelte and Language Tools diff --git a/apps/svelte.dev/content/blog/2023-04-01-whats-new-in-svelte-april-2023.md b/apps/svelte.dev/content/blog/2023-04-01-whats-new-in-svelte-april-2023.md index 5369ffcb54..3bcd5bfb4a 100644 --- a/apps/svelte.dev/content/blog/2023-04-01-whats-new-in-svelte-april-2023.md +++ b/apps/svelte.dev/content/blog/2023-04-01-whats-new-in-svelte-april-2023.md @@ -33,8 +33,8 @@ For all the changes to the Svelte compiler, including unreleased changes, check ## What's new in SvelteKit -- You can now get all cookies for a request with `cookies.getAll` (**1.10.0**, [#9287](https://github.com/sveltejs/kit/pull/9287), [Docs](https://kit.svelte.dev/docs/types#public-types-cookies)) -- Easily manage the submission status of (multiple) forms with the new exposed `submitter` parameter in `use:enhance` (**1.12.0**, [#9425](https://github.com/sveltejs/kit/pull/9425), [Docs](https://kit.svelte.dev/docs/types#public-types-submitfunction)) +- You can now get all cookies for a request with `cookies.getAll` (**1.10.0**, [#9287](https://github.com/sveltejs/kit/pull/9287), [Docs](/docs/kit/@sveltejs-kit#Cookies)) +- Easily manage the submission status of (multiple) forms with the new exposed `submitter` parameter in `use:enhance` (**1.12.0**, [#9425](https://github.com/sveltejs/kit/pull/9425), [Docs](/docs/kit/@sveltejs-kit#SubmitFunction)) - The default error page now has dark mode styles (**1.13.0**, [#9460](https://github.com/sveltejs/kit/pull/9460)) - You can now omit types on all methods and variables with special meaning to SvelteKit and still benefit from full type safety! Read more about it in the [announcement blog post](https://svelte.dev/blog/zero-config-type-safety) diff --git a/apps/svelte.dev/content/blog/2023-06-01-whats-new-in-svelte-june-2023.md b/apps/svelte.dev/content/blog/2023-06-01-whats-new-in-svelte-june-2023.md index 7c56a8e18e..6fae813147 100644 --- a/apps/svelte.dev/content/blog/2023-06-01-whats-new-in-svelte-june-2023.md +++ b/apps/svelte.dev/content/blog/2023-06-01-whats-new-in-svelte-june-2023.md @@ -27,11 +27,11 @@ For all the changes to the Svelte compiler, including unreleased changes, check ## What's new in SvelteKit -- Route-level entry generators allow exporting an entries function from `+page`, `+page.server`, and `+server` files to supply possible values for params for prerendering (**1.16.0**, [Docs](https://kit.svelte.dev/docs/page-options#entries), [#9571](https://github.com/sveltejs/kit/pull/9571)) -- URLs in `` tags are now crawled to make programmatic social-images much easier (**1.17.0**, [Docs](https://kit.svelte.dev/docs/seo#manual-setup-title-and-meta), [#9900](https://github.com/sveltejs/kit/pull/9900)) -- `data` and `form` have been renamed to `formData` and `formElement` respectively in the `enhance` function. Using them through the old names will log a deprecation warning and they'll be removed in a future version. (**1.17.0**, [Docs](https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance), [#9902](https://github.com/sveltejs/kit/pull/9902)) -- Link options can now be set to `true` and `false` (**1.19.0**, [Docs](https://kit.svelte.dev/docs/link-options#disabling-options), [#10039](https://github.com/sveltejs/kit/pull/10039)) -- The new `resolvePath` export can be used to build relative paths from route IDs and parameters (**1.19.0**, [Docs](https://kit.svelte.dev/docs/modules#sveltejs-kit-resolvepath), [#9949](https://github.com/sveltejs/kit/pull/9949)) +- Route-level entry generators allow exporting an entries function from `+page`, `+page.server`, and `+server` files to supply possible values for params for prerendering (**1.16.0**, [Docs](/docs/kit/page-options#entries), [#9571](https://github.com/sveltejs/kit/pull/9571)) +- URLs in `` tags are now crawled to make programmatic social-images much easier (**1.17.0**, [Docs](/docs/kit/seo#Manual-setup-title-and-meta), [#9900](https://github.com/sveltejs/kit/pull/9900)) +- `data` and `form` have been renamed to `formData` and `formElement` respectively in the `enhance` function. Using them through the old names will log a deprecation warning and they'll be removed in a future version. (**1.17.0**, [Docs](/docs/kit/form-actions#Progressive-enhancement-use:enhance), [#9902](https://github.com/sveltejs/kit/pull/9902)) +- Link options can now be set to `true` and `false` (**1.19.0**, [Docs](/docs/kit/link-options#Disabling-options), [#10039](https://github.com/sveltejs/kit/pull/10039)) +- The new `resolvePath` export can be used to build relative paths from route IDs and parameters (**1.19.0**, [#9949](https://github.com/sveltejs/kit/pull/9949)) --- diff --git a/apps/svelte.dev/content/blog/2023-07-01-whats-new-in-svelte-july-2023.md b/apps/svelte.dev/content/blog/2023-07-01-whats-new-in-svelte-july-2023.md index bf12e6f16e..28ef782f34 100644 --- a/apps/svelte.dev/content/blog/2023-07-01-whats-new-in-svelte-july-2023.md +++ b/apps/svelte.dev/content/blog/2023-07-01-whats-new-in-svelte-july-2023.md @@ -19,9 +19,9 @@ For a full list of all the changes to the Svelte compiler, including unreleased This month there were lots of awesome [bug fixes](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md), so be sure to upgrade to the latest version! There are also a few new features to mention: -- The new `event.isSubRequest` boolean indicates whether this is a same-origin fetch request to one of the app's own APIs during a server request (**1.21.0**, [Docs](https://kit.svelte.dev/docs/types#public-types-requestevent), [#10170](https://github.com/sveltejs/kit/pull/10170)) -- A new config option, `config.kit.env.privatePrefix` will set a private prefix on environment variables. This defaults to `''` (**1.21.0**, [Docs](https://kit.svelte.dev/docs/configuration), [#9996](https://github.com/sveltejs/kit/pull/9996)) -- `VERSION` is now exported and accessible via `@sveltejs/kit`. This can be used for feature detection or anything else that requires knowledge of the current version of SvelteKit (**1.21.0**, [Docs](https://kit.svelte.dev/docs/modules#sveltejs-kit-version), [#9969](https://github.com/sveltejs/kit/pull/9969)) +- The new `event.isSubRequest` boolean indicates whether this is a same-origin fetch request to one of the app's own APIs during a server request (**1.21.0**, [Docs](/docs/kit/@sveltejs-kit#RequestEvent), [#10170](https://github.com/sveltejs/kit/pull/10170)) +- A new config option, `config.kit.env.privatePrefix` will set a private prefix on environment variables. This defaults to `''` (**1.21.0**, [Docs](/docs/kit/configuration), [#9996](https://github.com/sveltejs/kit/pull/9996)) +- `VERSION` is now exported and accessible via `@sveltejs/kit`. This can be used for feature detection or anything else that requires knowledge of the current version of SvelteKit (**1.21.0**, [Docs](/docs/kit/@sveltejs-kit#VERSION), [#9969](https://github.com/sveltejs/kit/pull/9969)) For adapter-specific changes, check out the CHANGELOGs in each of [the `adapter` directories](https://github.com/sveltejs/kit/tree/master/packages). diff --git a/apps/svelte.dev/content/blog/2023-08-01-whats-new-in-svelte-august-2023.md b/apps/svelte.dev/content/blog/2023-08-01-whats-new-in-svelte-august-2023.md index aee2458a0f..17eceae4c8 100644 --- a/apps/svelte.dev/content/blog/2023-08-01-whats-new-in-svelte-august-2023.md +++ b/apps/svelte.dev/content/blog/2023-08-01-whats-new-in-svelte-august-2023.md @@ -19,8 +19,8 @@ In addition to supporting SvelteKit's new `HEAD` server method, Svelte's languag ## What's new in SvelteKit -- The `HEAD` server method is now available in API routes (**1.22.0**, [Docs](https://kit.svelte.dev/docs/routing#server), [#9753](https://github.com/sveltejs/kit/pull/9753)) -- Responses with `Vary` headers are now cached, too (except for `Vary: *`) (**1.22.0**, [Docs](https://kit.svelte.dev/docs/routing#server-content-negotiation), [#9993](https://github.com/sveltejs/kit/pull/9993)) +- The `HEAD` server method is now available in API routes (**1.22.0**, [Docs](/docs/kit/routing#server), [#9753](https://github.com/sveltejs/kit/pull/9753)) +- Responses with `Vary` headers are now cached, too (except for `Vary: *`) (**1.22.0**, [Docs](/docs/kit/routing#server-Content-negotiation), [#9993](https://github.com/sveltejs/kit/pull/9993)) - There's now a more helpful error for preview if SvelteKit's build output doesn't exist (**1.22.2**, [#10337](https://github.com/sveltejs/kit/pull/10337)) For all the patches and performance updates from this month, check out the [SvelteKit CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). You can also find adapter-specific CHANGELOGs in each of [the `adapter` directories](https://github.com/sveltejs/kit/tree/master/packages). diff --git a/apps/svelte.dev/content/blog/2023-08-31-view-transitions.md b/apps/svelte.dev/content/blog/2023-08-31-view-transitions.md index 6e1fc58a10..56130a90f3 100644 --- a/apps/svelte.dev/content/blog/2023-08-31-view-transitions.md +++ b/apps/svelte.dev/content/blog/2023-08-31-view-transitions.md @@ -7,7 +7,7 @@ authorURL: https://geoffrich.net The [view transitions API](https://developer.chrome.com/docs/web-platform/view-transitions/) has been sweeping the web development world lately, and for good reason. It streamlines the process of animating between two page states, which is especially useful for page transitions. -However, until now, you couldn’t easily use this API in a SvelteKit app, since it was difficult to slot into the right place in the navigation lifecycle. SvelteKit 1.24 brought a new [`onNavigate`](https://kit.svelte.dev/docs/$app-navigation#onNavigate) lifecycle hook to make view transitions integration much easier – let’s dive in. +However, until now, you couldn’t easily use this API in a SvelteKit app, since it was difficult to slot into the right place in the navigation lifecycle. SvelteKit 1.24 brought a new [`onNavigate`](/docs/kit/$app-navigation#onNavigate) lifecycle hook to make view transitions integration much easier – let’s dive in. ## How view transitions work @@ -30,9 +30,9 @@ It’s important to note that view transitions is a browser API, not a SvelteKit ## How `onNavigate` works -Before learning how to write view transitions, let's highlight the function that makes it all possible: [`onNavigate`](https://kit.svelte.dev/docs/$app-navigation#onNavigate). +Before learning how to write view transitions, let's highlight the function that makes it all possible: [`onNavigate`](/docs/kit/$app-navigation#onNavigate). -Until recently, SvelteKit had two navigation lifecycle functions: [`beforeNavigate`](https://kit.svelte.dev/docs/$app-navigation#beforeNavigate), which fires before a navigation starts, and [`afterNavigate`](https://kit.svelte.dev/docs/$app-navigation#afterNavigate), which fires after the page has been updated following a navigation. SvelteKit 1.24 introduces a third: `onNavigate`, which will fire on every navigation, immediately before the new page is rendered. Importantly, it will run _after_ any data loading for the page has completed – since starting a view transition prevents any interaction with the page, we want to start it as late as possible. +Until recently, SvelteKit had two navigation lifecycle functions: [`beforeNavigate`](/docs/kit/$app-navigation#beforeNavigate), which fires before a navigation starts, and [`afterNavigate`](/docs/kit/$app-navigation#afterNavigate), which fires after the page has been updated following a navigation. SvelteKit 1.24 introduces a third: `onNavigate`, which will fire on every navigation, immediately before the new page is rendered. Importantly, it will run _after_ any data loading for the page has completed – since starting a view transition prevents any interaction with the page, we want to start it as late as possible. You can also return a promise from `onNavigate`, which will suspend the navigation until it resolves. This will let us wait to complete the navigation until the view transition has started. diff --git a/apps/svelte.dev/content/blog/2023-09-01-whats-new-in-svelte-september-2023.md b/apps/svelte.dev/content/blog/2023-09-01-whats-new-in-svelte-september-2023.md index f8305ee358..966328ca0c 100644 --- a/apps/svelte.dev/content/blog/2023-09-01-whats-new-in-svelte-september-2023.md +++ b/apps/svelte.dev/content/blog/2023-09-01-whats-new-in-svelte-september-2023.md @@ -15,9 +15,9 @@ Before we jump in, a warm welcome to the new Svelte Ambassadors: [@cainux](https ## What's new in SvelteKit -- `URL` is now accepted in the `redirect` function (**1.23.0**, [Docs](https://kit.svelte.dev/docs/modules#sveltejs-kit-redirect), [#10570](https://github.com/sveltejs/kit/pull/10570)) +- `URL` is now accepted in the `redirect` function (**1.23.0**, [Docs](/docs/kit/@sveltejs-kit#redirect), [#10570](https://github.com/sveltejs/kit/pull/10570)) - Mistyped route filenames will now throw a warning (**1.23.0**, [#10558](https://github.com/sveltejs/kit/pull/10558)) -- The new `onNavigate` lifecycle function enables view transitions - Check out the [blog post](https://svelte.dev/blog/view-transitions) for more info (**1.24.0**, [Docs](https://kit.svelte.dev/docs/modules#app-navigation-onnavigate), [#9605](https://github.com/sveltejs/kit/pull/9605)) +- The new `onNavigate` lifecycle function enables view transitions - Check out the [blog post](https://svelte.dev/blog/view-transitions) for more info (**1.24.0**, [Docs](/docs/kit/$app-navigation#onNavigate), [#9605](https://github.com/sveltejs/kit/pull/9605)) But that's just the new features! For all the patches and performance updates from this month, check out the [SvelteKit CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). You can also find adapter-specific CHANGELOGs in each of [the `adapter` directories](https://github.com/sveltejs/kit/tree/master/packages). diff --git a/apps/svelte.dev/content/blog/2023-10-01-whats-new-in-svelte-october-2023.md b/apps/svelte.dev/content/blog/2023-10-01-whats-new-in-svelte-october-2023.md index 9be2ff7053..02660924a6 100644 --- a/apps/svelte.dev/content/blog/2023-10-01-whats-new-in-svelte-october-2023.md +++ b/apps/svelte.dev/content/blog/2023-10-01-whats-new-in-svelte-october-2023.md @@ -14,7 +14,7 @@ Svelte 5 isn't out yet (you can, however, [preview it now](https://svelte-5-prev ## What's new in SvelteKit -- `+server.js` now has a catch-all handler that handles all unimplemented valid server requests. Just export a `fallback` function! (**1.25.0**, [Docs](https://kit.svelte.dev/docs/routing#server-fallback-method-handler), [#9755](https://github.com/sveltejs/kit/pull/9755)) +- `+server.js` now has a catch-all handler that handles all unimplemented valid server requests. Just export a `fallback` function! (**1.25.0**, [Docs](/docs/kit/routing#server-Fallback-method-handler), [#9755](https://github.com/sveltejs/kit/pull/9755)) That's all for the new features! If you're looking for other patches and performance updates, check out the [SvelteKit CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). You can also find adapter-specific CHANGELOGs in each of [the `adapter` directories](https://github.com/sveltejs/kit/tree/master/packages). diff --git a/apps/svelte.dev/content/blog/2023-11-01-whats-new-in-svelte-november-2023.md b/apps/svelte.dev/content/blog/2023-11-01-whats-new-in-svelte-november-2023.md index 295113ba65..56f9e4ee7a 100644 --- a/apps/svelte.dev/content/blog/2023-11-01-whats-new-in-svelte-november-2023.md +++ b/apps/svelte.dev/content/blog/2023-11-01-whats-new-in-svelte-november-2023.md @@ -18,8 +18,8 @@ Let's take a closer look 👀... ## What's new in SvelteKit -- Route parameter types will now be inferred from the applicable matcher's guard check (**kit@1.26.0**, [Docs](https://kit.svelte.dev/docs/advanced-routing#matching), [#10755](https://github.com/sveltejs/kit/pull/10755)) -- The new `invalidateAll` boolean option lets you turn on and off the `invalidateAll()` form function within the `enhance` callback (**kit@1.27.0**, [Docs](https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance), [#9476](https://github.com/sveltejs/kit/issues/9476)) +- Route parameter types will now be inferred from the applicable matcher's guard check (**kit@1.26.0**, [Docs](/docs/kit/advanced-routing#Matching), [#10755](https://github.com/sveltejs/kit/pull/10755)) +- The new `invalidateAll` boolean option lets you turn on and off the `invalidateAll()` form function within the `enhance` callback (**kit@1.27.0**, [Docs](/docs/kit/form-actions#Progressive-enhancement-use:enhance), [#9476](https://github.com/sveltejs/kit/issues/9476)) - The output of the project creation wizard will now reflect which package manager you're using (**create-svelte@5.1.1**, [#10811](https://github.com/sveltejs/kit/pull/10811)) For a complete list of bug fixes and performance updates, check out the [SvelteKit CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). You can also find adapter-specific CHANGELOGs in each of [the `adapter` directories](https://github.com/sveltejs/kit/tree/master/packages). diff --git a/apps/svelte.dev/content/blog/2023-12-01-whats-new-in-svelte-december-2023.md b/apps/svelte.dev/content/blog/2023-12-01-whats-new-in-svelte-december-2023.md index 1da17dc7d9..ed14a22692 100644 --- a/apps/svelte.dev/content/blog/2023-12-01-whats-new-in-svelte-december-2023.md +++ b/apps/svelte.dev/content/blog/2023-12-01-whats-new-in-svelte-december-2023.md @@ -39,7 +39,7 @@ For all the release notes going forward, check out [the CHANGELOG on main](https - Creating a new SvelteKit project will now ask if you want to try the Svelte 5 beta ([#11026](https://github.com/sveltejs/kit/pull/11026)) - Prettier 3 and `prettier-plugin-svelte` 3 are now the default versions when creating new SvelteKit projects ([#10410](https://github.com/sveltejs/kit/pull/10410)) - nodejs20.x is now supported via the Vercel adapter ([#11067](https://github.com/sveltejs/kit/pull/11067)) -- `@sveltejs/enhanced-img` makes serving different sizes of images easy, thanks to pre-processing ([Docs](https://kit.svelte.dev/docs/images#sveltejs-enhanced-img), [#10788](https://github.com/sveltejs/kit/pull/10788)) +- `@sveltejs/enhanced-img` makes serving different sizes of images easy, thanks to pre-processing ([Docs](/docs/kit/images#sveltejs-enhanced-img), [#10788](https://github.com/sveltejs/kit/pull/10788)) For a complete list of bug fixes and performance updates, check out the [SvelteKit CHANGELOG](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md). You can also find adapter-specific CHANGELOGs in each of [the `adapter` directories](https://github.com/sveltejs/kit/tree/master/packages). diff --git a/apps/svelte.dev/content/blog/2023-12-14-sveltekit-2.md b/apps/svelte.dev/content/blog/2023-12-14-sveltekit-2.md index 1085d1bbb7..d5ce144aa8 100644 --- a/apps/svelte.dev/content/blog/2023-12-14-sveltekit-2.md +++ b/apps/svelte.dev/content/blog/2023-12-14-sveltekit-2.md @@ -15,13 +15,13 @@ We recommend updating to the most recent 1.x release first, along with Svelte 4, npx svelte-migrate sveltekit-2 ``` -The [migration guide](https://kit.svelte.dev/docs/migrating-to-sveltekit-2) has more details about what's new. +The [migration guide](/docs/kit/migrating-to-sveltekit-2) has more details about what's new. ## Shallow routing Way back in the mists of time — May, to be precise — we [teased a new feature](https://www.youtube.com/watch?v=HdkJTOTY-Js) that allows you to associate state with a history entry without causing navigation. It's very useful for creating modals that you can dismiss by swiping back, or pop-up views of routes you don't want to do a full navigation to. -That feature is called [shallow routing](https://kit.svelte.dev/docs/shallow-routing), and this week we finally dusted off the pull request and added it to the framework. We're excited to see what you use it for. +That feature is called [shallow routing](/docs/kit/shallow-routing), and this week we finally dusted off the pull request and added it to the framework. We're excited to see what you use it for. ## One year of SvelteKit @@ -36,7 +36,7 @@ In the past year, we’ve seen a number of open source projects like [Storybook] SvelteKit continues to benefit from the Svelte community, which has developed numerous great UI libraries like [Skeleton](https://www.skeleton.dev/), [shadcn-svelte](https://www.shadcn-svelte.com/), [Melt UI](https://melt-ui.com/), [Flowbite Svelte](https://flowbite-svelte.com/), [daisyUI](https://daisyui.com/), and [many more](https://sveltesociety.dev/packages?category=design-system). And [our first ever hackathon](https://hack.sveltesociety.dev/) saw winners from amazing Svelte projects like [Superforms](https://superforms.rocks/), [Threlte](https://threlte.xyz/), and [SvelteLab](https://www.sveltelab.dev/). -Finally, we’ve also launched major supporting projects like a new Svelte DevTools ([chrome web store](https://chromewebstore.google.com/detail/svelte-devtools/kfidecgcdjjfpeckbblhmfkhmlgecoff), [GitHub](https://github.com/sveltejs/svelte-devtools), [talk](https://www.sveltesummit.com/2023/fall/exploring-svelte-devtools)), Svelte Inspector ([docs](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/inspector.md), [talk](https://www.sveltesummit.com/2023/spring/svelte-inspector-update)), and experimental image optimization support ([docs](https://kit.svelte.dev/docs/images), [talk](https://www.sveltesummit.com/2023/fall/enhanced-img)). +Finally, we’ve also launched major supporting projects like a new Svelte DevTools ([chrome web store](https://chromewebstore.google.com/detail/svelte-devtools/kfidecgcdjjfpeckbblhmfkhmlgecoff), [GitHub](https://github.com/sveltejs/svelte-devtools), [talk](https://www.sveltesummit.com/2023/fall/exploring-svelte-devtools)), Svelte Inspector ([docs](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/inspector.md), [talk](https://www.sveltesummit.com/2023/spring/svelte-inspector-update)), and experimental image optimization support ([docs](/docs/kit/images), [talk](https://www.sveltesummit.com/2023/fall/enhanced-img)). ## Upcoming diff --git a/apps/svelte.dev/content/blog/2024-01-01-whats-new-in-svelte-january-2024.md b/apps/svelte.dev/content/blog/2024-01-01-whats-new-in-svelte-january-2024.md index 305c3f5498..bd23816ce1 100644 --- a/apps/svelte.dev/content/blog/2024-01-01-whats-new-in-svelte-january-2024.md +++ b/apps/svelte.dev/content/blog/2024-01-01-whats-new-in-svelte-january-2024.md @@ -13,18 +13,18 @@ Let's jump in... ## What's new in SvelteKit (2.0 and more!) -With its 2.0 release, SvelteKit is now more capable than ever. Be sure to check out the docs links in each update for more info on how to use each feature as well as the new [Performance](https://kit.svelte.dev/docs/performance) page - which explains how SvelteKit works to make your applications as performant as possible. +With its 2.0 release, SvelteKit is now more capable than ever. Be sure to check out the docs links in each update for more info on how to use each feature as well as the new [Performance](/docs/kit/performance) page - which explains how SvelteKit works to make your applications as performant as possible. -- `resolvePath` has been replaced by `resolveRoute` in `$app/paths`. Use it to populate a route ID with params to resolve a pathname (**1.29.0**, [Docs](https://kit.svelte.dev/docs/modules#app-paths-resolveroute), [#11261](https://github.com/sveltejs/kit/pull/11261)) -- `response.arrayBuffer()` will now be inlined during SSR (**1.30.0**, [Docs](https://kit.svelte.dev/docs/load#making-fetch-requests), [#10535](https://github.com/sveltejs/kit/pull/10535)) +- `resolvePath` has been replaced by `resolveRoute` in `$app/paths`. Use it to populate a route ID with params to resolve a pathname (**1.29.0**, [Docs](/docs/kit/$app-paths#resolveRoute), [#11261](https://github.com/sveltejs/kit/pull/11261)) +- `response.arrayBuffer()` will now be inlined during SSR (**1.30.0**, [Docs](/docs/kit/load#Making-fetch-requests), [#10535](https://github.com/sveltejs/kit/pull/10535)) - [SvelteKit 2.0.0](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md#200) adds: - - `untrack` to `load` to opt-out of invalidation ([Docs](https://kit.svelte.dev/docs/load#rerunning-load-functions-untracking-dependencies), [#11311](https://github.com/sveltejs/kit/pull/11311)) - - shallow routing to create history entries without navigating ([Docs](https://kit.svelte.dev/docs/shallow-routing), [#11307](https://github.com/sveltejs/kit/pull/11307)) + - `untrack` to `load` to opt-out of invalidation ([Docs](/docs/kit/load#Rerunning-load-functions-Untracking-dependencies), [#11311](https://github.com/sveltejs/kit/pull/11311)) + - shallow routing to create history entries without navigating ([Docs](/docs/kit/shallow-routing), [#11307](https://github.com/sveltejs/kit/pull/11307)) - html typings ([#11222](https://github.com/sveltejs/kit/pull/11222)) - redacted internal stack traces when reporting config errors ([#11292](https://github.com/sveltejs/kit/pull/11292)) - - fine grained invalidation of search params ([Docs](https://kit.svelte.dev/docs/load#rerunning-load-functions), [#11258](https://github.com/sveltejs/kit/pull/11258)) + - fine grained invalidation of search params ([Docs](/docs/kit/load#Rerunning-load-functions), [#11258](https://github.com/sveltejs/kit/pull/11258)) -You can find a migration guide for SvelteKit 2.0 [on the SvelteKit docs](https://kit.svelte.dev/docs/migrating-to-sveltekit-2). Things should be pretty seamless with the `svelte-migrate` command doing much (if not all) for you! +You can find a migration guide for SvelteKit 2.0 [on the SvelteKit docs](/docs/kit/migrating-to-sveltekit-2). Things should be pretty seamless with the `svelte-migrate` command doing much (if not all) for you! ## What's new in Svelte diff --git a/apps/svelte.dev/content/blog/2024-02-01-whats-new-in-svelte-february-2024.md b/apps/svelte.dev/content/blog/2024-02-01-whats-new-in-svelte-february-2024.md index f8742e6f4b..2cb9f47721 100644 --- a/apps/svelte.dev/content/blog/2024-02-01-whats-new-in-svelte-february-2024.md +++ b/apps/svelte.dev/content/blog/2024-02-01-whats-new-in-svelte-february-2024.md @@ -14,11 +14,11 @@ So let's dive in to check out what's new and see what the rest of the community ## What's new in SvelteKit - The client router is now tree shakeable (**2.1.0**, [#11340](https://github.com/sveltejs/kit/pull/11340)) -- `$env/static/public` is now exposed in service workers (**2.2.0**, [Docs](https://kit.svelte.dev/docs/modules#env-static-public), [#10994](https://github.com/sveltejs/kit/pull/10994)) -- `style-src-elem` is now supported in environments with a Content Security Policy (**2.2.1**, [Docs](https://kit.svelte.dev/docs/types#private-types-cspdirectives), [#11562](https://github.com/sveltejs/kit/pull/11562)) -- The new `reroute` hook allows you to change how URLs are translated into routes (**2.3.0**, [Docs](https://kit.svelte.dev/docs/hooks#universal-hooks-reroute), [#11537](https://github.com/sveltejs/kit/pull/11537)) -- The `read` function is now available in the `$app/server` module - allowing you to read assets from the filesystem (**2.4.0**, [Docs](https://kit.svelte.dev/docs/modules#app-server-read), [#11649](https://github.com/sveltejs/kit/pull/11649)) -- Adapters can now `emulate` the prod environment for dev and preview servers by implementing the corresponding functions. This is useful for providing access to e.g. KV namespaces in development (**2.5.0**, [Docs](https://kit.svelte.dev/docs/writing-adapters), [#11730](https://github.com/sveltejs/kit/pull/11730)) +- `$env/static/public` is now exposed in service workers (**2.2.0**, [Docs](/docs/kit/$env-static-public), [#10994](https://github.com/sveltejs/kit/pull/10994)) +- `style-src-elem` is now supported in environments with a Content Security Policy (**2.2.1**, [Docs](/docs/kit/@sveltejs-kit#CspDirectives), [#11562](https://github.com/sveltejs/kit/pull/11562)) +- The new `reroute` hook allows you to change how URLs are translated into routes (**2.3.0**, [Docs](/docs/kit/hooks#Universal-hooks-reroute), [#11537](https://github.com/sveltejs/kit/pull/11537)) +- The `read` function is now available in the `$app/server` module - allowing you to read assets from the filesystem (**2.4.0**, [Docs](/docs/kit/$app-server#read), [#11649](https://github.com/sveltejs/kit/pull/11649)) +- Adapters can now `emulate` the prod environment for dev and preview servers by implementing the corresponding functions. This is useful for providing access to e.g. KV namespaces in development (**2.5.0**, [Docs](/docs/kit/writing-adapters), [#11730](https://github.com/sveltejs/kit/pull/11730)) ## What's new in Svelte diff --git a/apps/svelte.dev/content/blog/2024-03-01-whats-new-in-svelte-march-2024.md b/apps/svelte.dev/content/blog/2024-03-01-whats-new-in-svelte-march-2024.md index f26674ae07..2025ac6a5a 100644 --- a/apps/svelte.dev/content/blog/2024-03-01-whats-new-in-svelte-march-2024.md +++ b/apps/svelte.dev/content/blog/2024-03-01-whats-new-in-svelte-march-2024.md @@ -25,7 +25,7 @@ For all the bug fixes, chores and underlying work required to get Svelte 5 to re Mostly bug fixes, this month. Most notably is a fix to prevent stale values after navigation (**2.5.1**, [#11870](https://github.com/sveltejs/kit/pull/11870)). -Adapters can also now use an `emulate` function to provide dev and preview functionality (**2.5.0**, [Docs](https://kit.svelte.dev/docs/writing-adapters), [#11730](https://github.com/sveltejs/kit/pull/11730)). This will allow for an improved experience developing for Cloudflare in the near future ([11732](https://github.com/sveltejs/kit/pull/11732)). +Adapters can also now use an `emulate` function to provide dev and preview functionality (**2.5.0**, [Docs](/docs/kit/writing-adapters), [#11730](https://github.com/sveltejs/kit/pull/11730)). This will allow for an improved experience developing for Cloudflare in the near future ([11732](https://github.com/sveltejs/kit/pull/11732)). For all the changes in SvelteKit, check out the [CHANGELOG](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md). diff --git a/apps/svelte.dev/content/blog/2024-04-01-whats-new-in-svelte-april-2024.md b/apps/svelte.dev/content/blog/2024-04-01-whats-new-in-svelte-april-2024.md index be45b5df03..1271d3ecea 100644 --- a/apps/svelte.dev/content/blog/2024-04-01-whats-new-in-svelte-april-2024.md +++ b/apps/svelte.dev/content/blog/2024-04-01-whats-new-in-svelte-april-2024.md @@ -28,9 +28,9 @@ Also, this month, a ton of new features have been merged into Svelte 5 to make i - `adapter-vercel` now has Skew Protection which ensures that the client and server stay in sync for any particular deployment (**@sveltejs/adapter-vercel@5.2.0**, [Docs](https://vercel.com/docs/deployments/skew-protection), [#11987](https://github.com/sveltejs/kit/pull/11987)) - `adapter-vercel`'s build output files now include framework metadata - improving observability on the platform (**@sveltejs/adapter-vercel@5.2.0**, [#11800](https://github.com/sveltejs/kit/pull/11800)) - `adapter-cloudflare` and `adapter-cloudflare-workers` now implement `adapter.emulate` which allows the adapter to emulate the Cloudflare platform during dev and preview ([#11732](https://github.com/sveltejs/kit/pull/11732)) -- **Breaking:** `adapter-node` now shuts down gracefully and supports the new `IDLE_TIMEOUT` and `SHUTDOWN_TIMEOUT` environment variables (**@sveltejs/adapter-node@5.0.1**, [Docs](https://kit.svelte.dev/docs/adapter-node#environment-variables-shutdown-timeout), [#11653](https://github.com/sveltejs/kit/pull/11653)) -- **Breaking:** The default value of `precompress` in `adapter-node` is now `true` - making sites faster by default (**@sveltejs/adapter-node@5.0.0**, [Docs](https://kit.svelte.dev/docs/adapter-node#options-precompress), [#11945](https://github.com/sveltejs/kit/pull/11945)) -- Google Cloud is now supported in `adapter-auto` without any additional configuration (**@sveltejs/adapter-auto@3.2.0**, [Docs](https://kit.svelte.dev/docs/adapter-auto), [#12015](https://github.com/sveltejs/kit/pull/12015)) +- **Breaking:** `adapter-node` now shuts down gracefully and supports the new `IDLE_TIMEOUT` and `SHUTDOWN_TIMEOUT` environment variables (**@sveltejs/adapter-node@5.0.1**, [Docs](/docs/kit/adapter-node#Environment-variables-SHUTDOWN-TIMEOUT), [#11653](https://github.com/sveltejs/kit/pull/11653)) +- **Breaking:** The default value of `precompress` in `adapter-node` is now `true` - making sites faster by default (**@sveltejs/adapter-node@5.0.0**, [Docs](/docs/kit/adapter-node#Options-precompress), [#11945](https://github.com/sveltejs/kit/pull/11945)) +- Google Cloud is now supported in `adapter-auto` without any additional configuration (**@sveltejs/adapter-auto@3.2.0**, [Docs](/docs/kit/adapter-auto), [#12015](https://github.com/sveltejs/kit/pull/12015)) For all the changes in SvelteKit, including bug fixes and adapter-specific changes check out the [CHANGELOGs in each of the packages](https://github.com/sveltejs/kit/tree/f1e73c2fe54280d254a1bdfba430a678f4db527a/packages). diff --git a/apps/svelte.dev/content/blog/2024-07-01-whats-new-in-svelte-july-2024.md b/apps/svelte.dev/content/blog/2024-07-01-whats-new-in-svelte-july-2024.md index 82e24c98f1..7173f04674 100644 --- a/apps/svelte.dev/content/blog/2024-07-01-whats-new-in-svelte-july-2024.md +++ b/apps/svelte.dev/content/blog/2024-07-01-whats-new-in-svelte-july-2024.md @@ -24,8 +24,8 @@ Below, you'll find the highlights from the Svelte 5 release notes (now in [Relea The node and Cloudflare adapters got a few upgrades this month: -- The `BODY_SIZE_LIMIT` environment variable adds unit suffixes support to the adapter-node - making it easier to write and comprehend large byte values (**adapter-node@5.2.0**, [Docs](https://kit.svelte.dev/docs/adapter-node#environment-variables-bodysizelimit), [#11680](https://github.com/sveltejs/kit/pull/11680)) -- Node servers can now listen to the `sveltekit:shutdown` event (replacing the more abrupt `exit`) that is emitted after the HTTP server has closed all connections (**adapter-node@5.1.0**, [Docs](https://kit.svelte.dev/docs/adapter-node#graceful-shutdown), [#12153](https://github.com/sveltejs/kit/pull/12153)) +- The `BODY_SIZE_LIMIT` environment variable adds unit suffixes support to the adapter-node - making it easier to write and comprehend large byte values (**adapter-node@5.2.0**, [Docs](/docs/kit/adapter-node#Environment-variables-BODYSIZELIMIT), [#11680](https://github.com/sveltejs/kit/pull/11680)) +- Node servers can now listen to the `sveltekit:shutdown` event (replacing the more abrupt `exit`) that is emitted after the HTTP server has closed all connections (**adapter-node@5.1.0**, [Docs](/docs/kit/adapter-node#Graceful-shutdown), [#12153](https://github.com/sveltejs/kit/pull/12153)) - The Cloudflare adapter will now only throw a `_routes.json` error when the file exists but there are no configured routes in svelte.config (**adapter-cloudflare@4.5.0**, [#12360](https://github.com/sveltejs/kit/pull/12360)) --- diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/01-concepts/01-introducing-sveltekit/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/01-concepts/01-introducing-sveltekit/index.md index 330efe3f5d..0866adad0a 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/01-concepts/01-introducing-sveltekit/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/01-concepts/01-introducing-sveltekit/index.md @@ -28,7 +28,7 @@ On the right, in the file tree viewer, you'll see a handful of files that Svelte > [!NOTE] Note that it also specifies `"type": "module"`, which means that `.js` files are treated as native JavaScript modules by default, rather than the legacy CommonJS format. -`svelte.config.js` contains your project configuration. We don't need to worry about this file for now, but if you're curious, [visit the documentation](https://kit.svelte.dev/docs/configuration). +`svelte.config.js` contains your project configuration. We don't need to worry about this file for now, but if you're curious, [visit the documentation](/docs/kit/configuration). `vite.config.js` contains the [Vite](https://vitejs.dev/) configuration. Because SvelteKit uses Vite, you can use [Vite features](https://vitejs.dev/guide/features.html) like hot module replacement, TypeScript support, static asset handling and so on. diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/02-routing/01-pages/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/02-routing/01-pages/index.md index 8aa227546d..1628539db3 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/02-routing/01-pages/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/02-routing/01-pages/index.md @@ -21,4 +21,4 @@ Let's fix that. Add a second page, `src/routes/about/+page.svelte`, copy the con We can now navigate between `/` and `/about`. -> [!NOTE] Unlike traditional multi-page apps, navigating to `/about` and back updates the contents of the current page, like a single-page app. This gives us the best of both worlds — fast server-rendered startup, then instant navigation. (This behaviour can be [configured](https://kit.svelte.dev/docs/page-options).) +> [!NOTE] Unlike traditional multi-page apps, navigating to `/about` and back updates the contents of the current page, like a single-page app. This gives us the best of both worlds — fast server-rendered startup, then instant navigation. (This behaviour can be [configured](/docs/kit/page-options).) diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/03-loading-data/02-layout-data/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/03-loading-data/02-layout-data/index.md index 387b1fcf2b..340a3d30da 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/03-loading-data/02-layout-data/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/03-loading-data/02-layout-data/index.md @@ -47,4 +47,4 @@ Now, add a sidebar in the layout for the post page: The layout (and any page below it) inherits `data.summaries` from the parent `+layout.server.js`. -When we navigate from one post to another, we only need to load the data for the post itself — the layout data is still valid. See the documentation on [invalidation](https://kit.svelte.dev/docs/load#rerunning-load-functions) to learn more. +When we navigate from one post to another, we only need to load the data for the post itself — the layout data is still valid. See the documentation on [invalidation](/docs/kit/load#Rerunning-load-functions) to learn more. diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/01-the-form-element/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/01-the-form-element/index.md index 7532c768ee..9ed23eee92 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/01-the-form-element/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/01-the-form-element/index.md @@ -4,7 +4,7 @@ title: The
element In the chapter on [loading data](page-data), we saw how to get data from the server to the browser. Sometimes you need to send data in the opposite direction, and that's where `` — the web platform's way of submitting data — comes in. -Let's build a todo app. We've already got an in-memory database set up in `src/lib/server/database.js`, and our `load` function in `src/routes/+page.server.js` uses the [`cookies`](https://kit.svelte.dev/docs/load#cookies) API so that we can have a per-user todo list, but we need to add a `` to create new todos: +Let's build a todo app. We've already got an in-memory database set up in `src/lib/server/database.js`, and our `load` function in `src/routes/+page.server.js` uses the [`cookies`](/docs/kit/load#Cookies) API so that we can have a per-user todo list, but we need to add a `` to create new todos: ```svelte /// file: src/routes/+page.svelte diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/05-customizing-use-enhance/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/05-customizing-use-enhance/index.md index cf6b99ff6a..71468dd839 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/05-customizing-use-enhance/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/06-forms/05-customizing-use-enhance/index.md @@ -104,4 +104,4 @@ In the case of deletions, we don't really need to wait for the server to validat ``` -> [!NOTE] `use:enhance` is very customizable — you can `cancel()` submissions, handle redirects, control whether the form is reset, and so on. [See the docs](https://kit.svelte.dev/docs/modules#$app-forms-enhance) for full details. +> [!NOTE] `use:enhance` is very customizable — you can `cancel()` submissions, handle redirects, control whether the form is reset, and so on. [See the docs](/docs/kit/$app-forms#enhance) for full details. diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/01-page-store/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/01-page-store/index.md index 1ab9016523..2c6e37af88 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/01-page-store/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/01-page-store/index.md @@ -6,7 +6,7 @@ title: page As we learned earlier, Svelte stores are a place to put data that doesn't belong to an individual component. -SvelteKit makes three readonly stores available via the `$app/stores` module — `page`, `navigating` and `updated`. The one you'll use most often is [`page`](https://kit.svelte.dev/docs/types#public-types-page), which provides information about the current page: +SvelteKit makes three readonly stores available via the `$app/stores` module — `page`, `navigating` and `updated`. The one you'll use most often is [`page`](/docs/kit/@sveltejs-kit#Page), which provides information about the current page: - `url` — the [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) of the current page - `params` — the current page's [parameters](params) diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/02-navigating-store/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/02-navigating-store/index.md index cfe9c6b964..27e13dce08 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/02-navigating-store/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/08-stores/02-navigating-store/index.md @@ -7,7 +7,7 @@ The `navigating` store represents the current navigation. When a navigation star - `from` and `to` — objects with `params`, `route` and `url` properties - `type` — the type of navigation, e.g. `link`, `popstate` or `goto` -> [!NOTE] For complete type information visit the [`Navigation`](https://kit.svelte.dev/docs/types#public-types-navigation) documentation. +> [!NOTE] For complete type information visit the [`Navigation`](/docs/kit/@sveltejs-kit#Navigation) documentation. It can be used to show a loading indicator for long-running navigations. In this exercise, `src/routes/+page.server.js` and `src/routes/about/+page.server.js` both have an artificial delay. Inside `src/routes/+layout.svelte`, import the `navigating` store and add a message to the nav bar: diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/01-error-basics/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/01-error-basics/index.md index 2f6227f897..9ea20e924a 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/01-error-basics/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/01-error-basics/index.md @@ -4,7 +4,7 @@ title: Basics There are two types of errors in SvelteKit — _expected_ errors and _unexpected_ errors. -An expected error is one that was thrown via the [`error`](https://kit.svelte.dev/docs/modules#sveltejs-kit-error) helper from `@sveltejs/kit`, as in `src/routes/expected/+page.server.js`: +An expected error is one that was thrown via the [`error`](/docs/kit/@sveltejs-kit#error) helper from `@sveltejs/kit`, as in `src/routes/expected/+page.server.js`: ```js /// file: src/routes/expected/+page.server.js diff --git a/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/xx-custom-error-messages/index.md b/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/xx-custom-error-messages/index.md index fcef02066d..e9eb9efb65 100644 --- a/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/xx-custom-error-messages/index.md +++ b/apps/svelte.dev/content/tutorial/03-sveltekit/09-errors-and-redirects/xx-custom-error-messages/index.md @@ -49,6 +49,6 @@ export function handleError(+++{ error }+++) { You could also call your error reporting service in these hooks. -Note that you can return more than an error message if you like. Whatever object shape you return will be available in `$page.error`, the only requirement is a `message` property. You can read more about this (and how to make it type-safe!) in the [error docs](https://kit.svelte.dev/docs/errors). +Note that you can return more than an error message if you like. Whatever object shape you return will be available in `$page.error`, the only requirement is a `message` property. You can read more about this (and how to make it type-safe!) in the [error docs](/docs/kit/errors). > [!NOTE] When handling errors, be careful to not assume it's an `Error` object, anything could be thrown. Also make sure not to expose senstive data by forwarding too much information diff --git a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/01-hooks/02-event/index.md b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/01-hooks/02-event/index.md index efeb2680ea..6108bdb2cf 100644 --- a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/01-hooks/02-event/index.md +++ b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/01-hooks/02-event/index.md @@ -2,7 +2,7 @@ title: The RequestEvent object --- -The `event` object passed into `handle` is the same object — an instance of a [`RequestEvent`](https://kit.svelte.dev/docs/types#public-types-requestevent) — that is passed into [API routes](get-handlers) in `+server.js` files, [form actions](the-form-element) in `+page.server.js` files, and `load` functions in `+page.server.js` and `+layout.server.js`. +The `event` object passed into `handle` is the same object — an instance of a [`RequestEvent`](/docs/kit/@sveltejs-kit#RequestEvent) — that is passed into [API routes](get-handlers) in `+server.js` files, [form actions](the-form-element) in `+page.server.js` files, and `load` functions in `+page.server.js` and `+layout.server.js`. It contains a number of useful properties and methods, some of which we've already encountered: diff --git a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/02-page-options/04-prerender/index.md b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/02-page-options/04-prerender/index.md index c251ae816d..f52ef28e82 100644 --- a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/02-page-options/04-prerender/index.md +++ b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/02-page-options/04-prerender/index.md @@ -17,6 +17,6 @@ export const prerender = true; Here in the tutorial, this won't have any observable effect, since the application is running in `dev` mode. -Not all pages can be prerendered. The basic rule is this: for content to be prerenderable, any two users hitting it directly must get the same content from the server, and the page must not contain form actions. Pages with dynamic route parameters can be prerendered as long as they are specified in the [`prerender.entries`](https://kit.svelte.dev/docs/configuration#prerender) configuration or can be reached by following links from pages that _are_ in `prerender.entries`. +Not all pages can be prerendered. The basic rule is this: for content to be prerenderable, any two users hitting it directly must get the same content from the server, and the page must not contain form actions. Pages with dynamic route parameters can be prerendered as long as they are specified in the [`prerender.entries`](/docs/kit/configuration#prerender) configuration or can be reached by following links from pages that _are_ in `prerender.entries`. > [!NOTE] Setting `prerender` to `true` inside your root `+layout.server.js` effectively turns SvelteKit into a static site generator (SSG). diff --git a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/03-link-options/02-reload/index.md b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/03-link-options/02-reload/index.md index fc6a7541d8..b5af775341 100644 --- a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/03-link-options/02-reload/index.md +++ b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/03-link-options/02-reload/index.md @@ -14,4 +14,4 @@ In rare cases, you might want to disable this behaviour. You can do so by adding ``` -For more information on available link options and their values, consult the [link options documentation](https://kit.svelte.dev/docs/link-options). +For more information on available link options and their values, consult the [link options documentation](/docs/kit/link-options). diff --git a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/01-universal-load-functions/index.md b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/01-universal-load-functions/index.md index 57cf42f43e..32bf1b9dbf 100644 --- a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/01-universal-load-functions/index.md +++ b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/01-universal-load-functions/index.md @@ -34,4 +34,4 @@ We can now use the `component` returned from these `load` functions like any oth ``` -Read the [documentation](https://kit.svelte.dev/docs/load#universal-vs-server) to learn more about the distinction between server `load` functions and universal `load` functions, and when to use which. +Read the [documentation](/docs/kit/load#Universal-vs-server) to learn more about the distinction between server `load` functions and universal `load` functions, and when to use which. diff --git a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/04-invalidation/index.md b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/04-invalidation/index.md index bf70393bda..ac741d1d1f 100644 --- a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/04-invalidation/index.md +++ b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/04-invalidation/index.md @@ -7,7 +7,7 @@ When the user navigates from one page to another, SvelteKit calls your `load` fu In this example, navigating between timezones causes the `load` function in `src/routes/[...timezone]/+page.js` to re-run because `params.timezone` is invalid. But the `load` function in `src/routes/+layout.js` does _not_ re-run, because as far as SvelteKit is concerned it wasn't invalidated by the navigation. -We can fix that by manually invalidating it using the [`invalidate(...)`](https://kit.svelte.dev/docs/$app-navigation#invalidate) function, which takes a URL and re-runs any `load` functions that depend on it. Because the `load` function in `src/routes/+layout.js` calls `fetch('/api/now')`, it depends on `/api/now`. +We can fix that by manually invalidating it using the [`invalidate(...)`](/docs/kit/$app-navigation#invalidate) function, which takes a URL and re-runs any `load` functions that depend on it. Because the `load` function in `src/routes/+layout.js` calls `fetch('/api/now')`, it depends on `/api/now`. In `src/routes/[...timezone]/+page.svelte`, add an `onMount` callback that calls `invalidate('/api/now')` once a second: diff --git a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/05-custom-dependencies/index.md b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/05-custom-dependencies/index.md index 2a10c6d7b1..2e4406101d 100644 --- a/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/05-custom-dependencies/index.md +++ b/apps/svelte.dev/content/tutorial/04-advanced-sveltekit/05-advanced-loading/05-custom-dependencies/index.md @@ -3,7 +3,7 @@ title: Custom dependencies path: /Europe/London --- -Calling `fetch(url)` inside a `load` function registers `url` as a dependency. Sometimes it's not appropriate to use `fetch`, in which case you can specify a dependency manually with the [`depends(url)`](https://kit.svelte.dev/docs/load#invalidation-manual-invalidation) function. +Calling `fetch(url)` inside a `load` function registers `url` as a dependency. Sometimes it's not appropriate to use `fetch`, in which case you can specify a dependency manually with the [`depends(url)`](/docs/kit/load#Rerunning-load-functions-Manual-invalidation) function. Since any string that begins with an `[a-z]+:` pattern is a valid URL, we can create custom invalidation keys like `data:now`.