-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
[Bug?] 404 page not generated for selected language #284
Comments
AFAIK only one 404 page is allowed, as the web server has to load a working file with a proper error message and styling. As for why the 404 page is in French/Japanese is because it's the last language that is built, and therefore overwrites the English (initial) version. I don't think there is an easy solution to this, because the 404 html source is rendered in another language, so even if there was some kind of working solution to remember the selected language it still wouldn't help in this case 🤔 The only solution I see right now, is to override the 404 page yourself and define your own additional logic on the JavaScript side to render the correct language, which of course I understand, isn't ideal. |
Same as @kamilkrzyskow this is problem is tied to MkDocs itself and the plugin can't have a generic solution for all themes either... |
Running into this issue as well with English & French, where French is being used for the 404 page. Is there are possibility to somehow force the English version? I don't mind the French page getting an English error page, but the other way around is a bit more annoying, as the majority of users will be using the English site.
Any concrete example on how to achieve this? 😄 |
@eXpl0it3r
Another idea would be a hook, which would assure that each generate 404.html for a given language would be preserved in a separate However, if the site is hosted on a server you can control you could map the 404 code to the appropriate This isn't a critical issue imo, so I'll likely not try to fix it myself. |
Thanks for your advice, @kamilkrzyskow . As I mentioned in another post, same has been happening to me with English and Japanese. What I ended up doing was creating two new files -- /en/404.md and /ja/404.md. Then I put the following into the 404.html override template:
This now redirects to the corresponding 404.md page, which keeps you on the correct language site. Hope that helps someone else! |
Overall, nice solution @mgriff88, much simpler to what I was suggesting 👍 However, now it redirects from This could be solved with some Also what happens after the user decides to go back in the browser ⬅️? Is the previous value being stored in the history and it will redirect to |
Good points, @kamilkrzyskow , you do lose the context of what the wrong/path/ is in this case. Here it is with a ref as you suggested:
And the result looks something like this: I've tested the back browser button in Chrome, Firefox, and Edge, and it works fine in all of them, no infinite looping or anything, just goes back to the page with the broken link. Thanks for your help! |
I have a site with two languages: English and Japanese.
If a user hits the 404 page when the English language is selected (English is the default), the nav and all elements switch to Japanese and the user is left on the Japanese version of the site.
This also occurs with the site for this plugin!
The text was updated successfully, but these errors were encountered: