From 10eb2a919da21e1b00172292b55d1fddf2f71550 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 9 Mar 2022 06:55:07 -0800 Subject: [PATCH 1/2] [docs] highlight need to set trailingSlash with adapter-static --- documentation/docs/09-adapters.md | 2 ++ documentation/docs/13-configuration.md | 6 +++--- packages/adapter-static/README.md | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/documentation/docs/09-adapters.md b/documentation/docs/09-adapters.md index d17df5ffb7a5..2b38ba1614ee 100644 --- a/documentation/docs/09-adapters.md +++ b/documentation/docs/09-adapters.md @@ -54,6 +54,8 @@ Most adapters will generate static HTML for any [prerenderable](/docs/page-optio You can also use `adapter-static` to generate single-page apps (SPAs) by specifying a [fallback page](https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode). +> You must ensure [`trailingSlash`](configuration#trailingslash) is set appropriately for your environment. If your host does not render `/a.html` upon receiving a request for `/a` then you will need to set `trailingSlash: 'always'`. + #### Platform-specific context Some adapters may have access to additional information about the request. For example, Cloudflare Workers can access an `env` object containing KV namespaces etc. This can be passed to the `RequestEvent` used in [hooks](/docs/hooks) and [endpoints](/docs/routing#endpoints) as the `platform` property — consult each adapter's documentation to learn more. diff --git a/documentation/docs/13-configuration.md b/documentation/docs/13-configuration.md index a087e11f2deb..534c21fa2103 100644 --- a/documentation/docs/13-configuration.md +++ b/documentation/docs/13-configuration.md @@ -275,9 +275,9 @@ An object containing zero or more of the following values: Whether to remove, append, or ignore trailing slashes when resolving URLs to routes. -- `"never"` — redirect `/x/` to `/x` -- `"always"` — redirect `/x` to `/x/` -- `"ignore"` — don't automatically add or remove trailing slashes. `/x` and `/x/` will be treated equivalently +- `'never'` — redirect `/x/` to `/x` +- `'always'` — redirect `/x` to `/x/` +- `'ignore'` — don't automatically add or remove trailing slashes. `/x` and `/x/` will be treated equivalently This option also affects [prerendering](/docs/page-options#prerender). If `trailingSlash` is `always`, a route like `/about` will result in an `about/index.html` file, otherwise it will create `about.html`, mirroring static webserver conventions. diff --git a/packages/adapter-static/README.md b/packages/adapter-static/README.md index f7148f374ed3..e9e5dba7b0a3 100644 --- a/packages/adapter-static/README.md +++ b/packages/adapter-static/README.md @@ -25,6 +25,8 @@ export default { Unless you're in [SPA mode](#spa-mode), the adapter will attempt to prerender every page of your app, regardless of whether the [`prerender`](https://kit.svelte.dev/docs/page-options#prerender) option is set. +> ⚠️ You must ensure SvelteKit's [`trailingSlash`](https://kit.svelte.dev/docs/configuration#trailingslash) option is set appropriately for your environment. If your host does not render `/a.html` upon receiving a request for `/a` then you will need to set `trailingSlash: 'always'`. + ## Options ### pages From 365de2310580e42fc7ad74d964021305460ae852 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 9 Mar 2022 08:11:09 -0800 Subject: [PATCH 2/2] mention index.html --- documentation/docs/09-adapters.md | 2 +- packages/adapter-static/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/docs/09-adapters.md b/documentation/docs/09-adapters.md index 2b38ba1614ee..bb8ccf24ae9c 100644 --- a/documentation/docs/09-adapters.md +++ b/documentation/docs/09-adapters.md @@ -54,7 +54,7 @@ Most adapters will generate static HTML for any [prerenderable](/docs/page-optio You can also use `adapter-static` to generate single-page apps (SPAs) by specifying a [fallback page](https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode). -> You must ensure [`trailingSlash`](configuration#trailingslash) is set appropriately for your environment. If your host does not render `/a.html` upon receiving a request for `/a` then you will need to set `trailingSlash: 'always'`. +> You must ensure [`trailingSlash`](configuration#trailingslash) is set appropriately for your environment. If your host does not render `/a.html` upon receiving a request for `/a` then you will need to set `trailingSlash: 'always'` to create `/a/index.html` instead. #### Platform-specific context diff --git a/packages/adapter-static/README.md b/packages/adapter-static/README.md index e9e5dba7b0a3..ff76cc83d5ad 100644 --- a/packages/adapter-static/README.md +++ b/packages/adapter-static/README.md @@ -25,7 +25,7 @@ export default { Unless you're in [SPA mode](#spa-mode), the adapter will attempt to prerender every page of your app, regardless of whether the [`prerender`](https://kit.svelte.dev/docs/page-options#prerender) option is set. -> ⚠️ You must ensure SvelteKit's [`trailingSlash`](https://kit.svelte.dev/docs/configuration#trailingslash) option is set appropriately for your environment. If your host does not render `/a.html` upon receiving a request for `/a` then you will need to set `trailingSlash: 'always'`. +> ⚠️ You must ensure SvelteKit's [`trailingSlash`](https://kit.svelte.dev/docs/configuration#trailingslash) option is set appropriately for your environment. If your host does not render `/a.html` upon receiving a request for `/a` then you will need to set `trailingSlash: 'always'` to create `/a/index.html` instead. ## Options