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

Navigation bar in 404 pages for older versions points to /stable #10643

Closed
astrojuanlu opened this issue Aug 17, 2023 · 4 comments
Closed

Navigation bar in 404 pages for older versions points to /stable #10643

astrojuanlu opened this issue Aug 17, 2023 · 4 comments
Labels
Support Support question

Comments

@astrojuanlu
Copy link
Contributor

Details

Expected Result

We are using https://sphinx-notfound-page.readthedocs.io/ to generate good-looking 404 pages on Read the Docs instead of the classic "maze found" page. This is a net improvement over what we had earlier. kedro-org/kedro#2486

We'd like these 404 pages to retain the navigation menu of older versions.

Actual Result

A description of what actually happened

  1. Open a URL that exists in /stable or /latest, for example https://docs.kedro.org/en/0.18.12/configuration/configuration_basics.html
  2. Switch the version in the flyout menu to an older one and arrive to a 404 page produced by sphinx-notfound-page, for example to 0.18.5
  3. Realize that the navigation links all point to /stable and wonder how is one supposed to reach the older version of the docs now ❓
  4. Try clicking the 0.18.5 version again in the flyout, only to land in https://docs.kedro.org/en/0.18.5/404.html with the navigation still pointing to /stable
  5. In frustration, click on the logo to go to the index, and switch version again, this time for real

Looking at https://sphinx-notfound-page.readthedocs.io/en/latest/configuration.html#confval-notfound_urls_prefix, we now realize that maybe this is intended behavior and sphinx-notfound-page is not a good solution for us. Do you know what could be an alternative that still gives a 404 page under our control, but retains the navigation? Should we add a 404.html to all older versions and rebuild them?

cc @stichbury

@astrojuanlu
Copy link
Contributor Author

I think this is essentially the same issue as ansible/ansible-documentation#94

@humitos
Copy link
Member

humitos commented Aug 17, 2023

Should we add a 404.html to all older versions and rebuild them?

Yes. (this is the short answer 😄 )


Right now, Read the Docs finds a 404.html in the current version you are reading, if it's not there, it tries the default version (in your case, stable). Since there is no 404.html page on the 0.18.5 version, it uses the one that found from stable. That's why all the links in the navigation bar points to stable version.

Unfortunately, there isn't too much Read the Docs can do here, but the solution would be to add the sphinx-notfound-page extension and re-build all the older versions.

@humitos humitos added the Support Support question label Aug 17, 2023
@humitos
Copy link
Member

humitos commented Aug 17, 2023

Unfortunately, there isn't too much Read the Docs can do here

I'm sure there are some other hacky JS solution that could be implemented. However, they would be pretty fragile and won't work for all the use-cases --but it's probably something you can implement on your side if you have a limited use-case.

I'm just thinking about "rewrite all the links with link.replace("/en/stable/", "/en/<current version>/") via a javascript in the 404.html page from the stable version" 🧑‍💻

@astrojuanlu
Copy link
Contributor Author

Thanks a lot @humitos! Knowing that I'm on the right path is reassuring anyway.

I guess this would be easier if we followed branch-based versioning, as you suggest in this blog post of yours I keep coming back to...

In any case, happy to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Support question
Projects
None yet
Development

No branches or pull requests

2 participants