-
Notifications
You must be signed in to change notification settings - Fork 76
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
gatsby-theme-i18n not redirecting to defaultLang when opening subpath without language prefix #124
Comments
mmm I feel we are never going to have a solution for this one. |
Are there any updates on this issue or workarounds? |
I've got a workaround, it's ugly but it works. I duplicated the pages of the default language. In gatsby-node.js : exports.onCreatePage = ({ page, actions }) => {
const { createPage } = actions;
if (page.path.startsWith("/fr/")) {
const newPage = { ...page, path: page.path.substring(3) };
createPage(newPage);
}
}; |
More than a year has passed; any suggestions? From the looks of it seems like using |
I just cloned the project ( I have a 404 not found on |
Describe the bug:
I am using the following configuration file for a gatsby.js page. With the defaultLang set to
en
, it correctly redirects the user fromdomain.com
to the localized versiondomain.com/en
. However, this redirect does not work with subpaths. Openingdomain.com/about
leads to 404.Expected behavior:
A user who accesses
domain.com/about
should by default redirect todomain.com/en/about
.Is there any way to do this with gatsby-theme-i18n directly or other workarounds? Thanks in advance!
I understand this might be by design. Alternatively, I could disable prefixDefault. Then
domain.com/about
would work, butdomain.com/en/bout
would lead to 404.The text was updated successfully, but these errors were encountered: