Skip to content

Separate trailingSlash and prerender build style/characteristic #5334

@mprather

Description

@mprather

Describe the problem

My team is building our first production site using sveltekit/svelte. It's a small, relatively simple site that is a perfect candidate for ssr. Today we realized that in order to use our storage provider (azure), we would need to use the trailingSlash=always option. Per the documentation, this will allow us to build the correct page/index.html files required by the underlying system.

The problem is that setting the option to 'always' results in a clunky user experience in the browser.

If the user manually goes to http://fqdn/myPage, the page is rendered and the user sees the same url. However, once they are on the site, if they use any link that takes them to myPage, they are sent to myPage/.

The result is that we are in exact "bad" scenario called out in the documentation where the user (and search engines) sees different urls for the same page.

Describe the proposed solution

I realize we're new to the svelte world and if I missed some configuration setting, please let me know. If not, then I would like to suggest that prerendering build style (page.html vs page/index.html) becomes a distinct option from the trailingSlash property.

It seems we would like to use trailingSlash=never (arguably there are fewer quirks when no slashes are artifically introduced) and have the static adapter use the "page/index.html" build style.

Alternatives considered

We need the page/index.html build artifacts. Otherwise, only the root page is directly fetchable (which is clearly a no-go). If separating trailingSlash from the build style is not a realistic option for sveltekit, then perhaps the underlying index.html files should force a 301 to the slashed version whenever a non-slashed page is rendered?

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions