Skip to content
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

Handle possible missing forward slash in url in changeLocale #51

Closed
RikuVan opened this issue Jul 20, 2019 · 1 comment
Closed

Handle possible missing forward slash in url in changeLocale #51

RikuVan opened this issue Jul 20, 2019 · 1 comment

Comments

@RikuVan
Copy link

RikuVan commented Jul 20, 2019

To ensure language changes work when the url does not contain for forward slash, would it be possible to add a check such as this (seems there is a TODO for this):

 if (allSitePage.includes(link) || allSitePage.includes(`${link}/`)) {
    gatsbyNavigate(link)
  } else {
    gatsbyNavigate(`/${language}/`)
  }

If you are just starting out with this this plugin it can be a bit of a head-scratcher at first why language changes do not work as intended.

@wiziple
Copy link
Owner

wiziple commented Jul 25, 2019

allSitePage array is not used anymore since gatsby team fixed matchPath, thanks!

@wiziple wiziple closed this as completed Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants