Skip to content

Using adapter-static and trailingSlash='always' in svelte.config.js doesn't work when using group layouts #10248

@jedfonner

Description

@jedfonner

Describe the bug

When:

  • Using adapter-static
  • and setting trailingSlash: 'always' inside the adapter settings in svelte.config.js
  • and using group layouts
    image

And:

  • running npm run build

Then:

  • route pages are still generated as /a.html instead of the expected /a/index.html .
    • Using the screenshot above, the build generates privacy.html and terms.html instead of privacy/index.html and terms/index.html

This is confusing because the adapter-static docs say that this should work.

To fix, you must add export const trailingSlash = 'always'; inside each +layout.ts file.

Reproduction

  1. Create a sample sveltekit project
  2. Add some group layouts with pages inside
  3. Configure it to use adapter static and set trailingSlash = 'always' in the adapter config is described here: https://kit.svelte.dev/docs/adapter-static#usage
  4. Run npm run build
  5. Notice the generated output in the build folder is of the format a.html instead of /a/index.html

Logs

No response

System Info

System:
    OS: Linux 5.19 KDE neon 5.27 5.27
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 3.44 GB / 15.38 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 114.0.5735.133
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/adapter-static: ^2.0.2 => 2.0.2 
    @sveltejs/kit: ^1.5.0 => 1.20.0 
    svelte: ^3.54.0 => 3.59.1 
    vite: ^4.3.0 => 4.3.9

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions