Skip to content

Commit

Permalink
[docs] highlight need to set trailingSlash with adapter-static (#4279)
Browse files Browse the repository at this point in the history
* [docs] highlight need to set trailingSlash with adapter-static

* mention index.html
  • Loading branch information
benmccann authored Mar 9, 2022
1 parent a7c9cb2 commit 42cd24f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions documentation/docs/09-adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'` to create `/a/index.html` instead.
#### 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.
Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/13-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions packages/adapter-static/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'` to create `/a/index.html` instead.
## Options

### pages
Expand Down

0 comments on commit 42cd24f

Please sign in to comment.