Hello! I posted this in #starlight and was asked to make a support thread so ta-da. Copying my message from that channel with additional information:
Original post:
I've noticed that trailing slashes are not consistent in starlight, is this correct?
If you define an internal link using the shorthand:
sidebar: [
"welcome",
...
It will generate a url to {site}/welcome.
But if you instead use autogenerate to do something like (and create a welcome/welcome.mdx to go along with it):
sidebar: [
{
label: 'Welcome',
autogenerate: { directory: 'welcome' },
},
...
It will generate a url to {site}/welcome/welcome/.
If you enable trailingSlash: "always", then it will add the trailing slash at the end of the first example, but even in production (using preview) which seems counter to what the docs say?
Is this correct, this seems wrong to me but maybe I'm missing something.
Additional information:
I spun up a fresh starlight project and you can obverse the same thing with the stock examples that are generated. The Example Guide (which uses a slug) is missing a trailing slash, where as the Reference (which uses autogenerate) contains a trailing slash.
When you build (and true in dev too, but trailingSlash is not supposed to affect prod), you can also see the hrefs that get generated in the files in the dist folder - when trailingSlash is not set (so default ignore) the href for the example guide is href="/guides/example" but when you set trailingSlash to always, the href in the html changes to href="/guides/example/"
Let me know if you need any further information! Thank you!