-
-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix language switcher trailingSlash
edge case
#2616
Conversation
🦋 Changeset detectedLatest commit: e8b0e2a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally too and the edge case seems to be fixed 🙌
I personally think it's fine to add the extra argument, we don't use that function in many places and it makes it easy to test without duplicating fixtures with multiple configs.
* main: Add issue and discussion templates for documentation improvements (withastro#2619) [ci] release (withastro#2618) Fix language switcher `trailingSlash` edge case (withastro#2616)
Description
trailingSlash
is not respected for the multilingual sites selector #2609<head>
metadata) even when Astro’strailingSlash: 'never'
was set.Astro.url
which is already in the correct format.URL
object can never have apathname
of""
. Settingpathname = ""
still results in apathname
of"/"
. This means that when prefixing a root locale homepage, we can’t rely only onpathname
to know if a trailing slash should be present or not.trailingSlash
option.trailingSlash
config a parameter to ourlocalizedUrl()
utility as this makes testing simpler, rather than importing the user config into the utility directly which would mean having to set up two separate test environments. But open to feedback if people think it would be better to avoid the extra parameter.