-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Search box on nested 404 page abc/123
goes to 404 abc/std/index.html?...
#54952
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
Comments
Ah, my bad. I was assuming that the 404 page wouldn't contain |
Problem is a bit more complicated than that: we need to keep the version we're looking at (stable, beta or nightly). Not a very complicated fix but still need to be careful. I'll open the PR soon. |
This got brought up again in rust-lang/www.rust-lang.org#864, so it's worth bringing @rust-lang/rustdoc and @rust-lang/docs into this thread as well. The primary concern is which libstd search to send the user to. |
I think the version thing can be maintained from the current page as a "black box" slug without having to parse it? The difficulty would seem to then be deciding whether a URL is versioned (like const path = new URL(window.location.href).pathname
const firstComponent = path.split('/')[0]
const fixedVersions = ["stable", "beta", "nightly"]
const includeFirst = fixedVersions.includes(firstComponent) || /^[0-9]/.test(firstComponent)
// inside the search submit:
document.location.href = (includeFirst ? "/" + firstComponent : "") + "/std/index.html?search=" ... |
This now redirects to this link which works as it's supposed to so closing this |
That link https://doc.rust-lang.org/std/index.html?search=123 has lost the version ( |
For instance, on https://doc.rust-lang.org/nightly/abc/123, the search box offers to search the standard library for 123. Clicking the search button goes to https://doc.rust-lang.org/nightly/abc/std/index.html?search=123 (note the
abc/std
) which is invalid. Probably related to#54609 (cc @GuillaumeGomez).
The text was updated successfully, but these errors were encountered: