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

Fix 404 error when docs version switching #2735

Merged
merged 5 commits into from
Dec 21, 2023

Conversation

adam-narozniak
Copy link
Member

@adam-narozniak adam-narozniak commented Dec 20, 2023

Issue

When switching from main (generally later - a branch that has a new documentation style = a single doc per function/class/module) to an older style documentation the error - 404 page not found - appears.

Description

e.g. from: https://flower.dev/docs/framework/main/en/ref-api/flwr.driver.html#module-flwr.driver
when the version gets switched to 1.6 - then such a page does not exist

Proposal

Fall back to the reference section of the index.html when the page cannot be found.

Explanation

Employ a dynamic check:
If the page exists (in the requested new version),
change to it;
elseif the page does not exist
fall back to the reference section in the idex.html.

A javascript function is created to handle the check. (not the local testing might be harder because the newUrl prefix is fixed as https://flower.dev/docs/framework/ (see function in versioning).

Note that coming back from the old version, to the new version
e.g. from https://flower.dev/docs/framework/v1.5.0/en/ref-api-flwr.html#module-flwr.server
to main (currently only the jump to main can be tested since that's the only version with the new type of docs), currently works by redirecting to the https://flower.dev/docs/framework/main/en/ref-api/flwr.html (which is the entry point of the documentation). I don't know why that mechanism works.

@adam-narozniak adam-narozniak self-assigned this Dec 20, 2023
@adam-narozniak adam-narozniak marked this pull request as ready for review December 20, 2023 13:31
@adam-narozniak adam-narozniak changed the title Fix 404 error when version switching Fix 404 error when docs version switching Dec 20, 2023
Copy link
Member

@charlesbvll charlesbvll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@tanertopal
Copy link
Member

@danieljanes, I am okay with the solution to this issue. Wdyt?

Copy link
Member

@danieljanes danieljanes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@danieljanes danieljanes merged commit 577bd7e into main Dec 21, 2023
27 checks passed
@danieljanes danieljanes deleted the fix-404-when-version-switching branch December 21, 2023 11:18
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

Successfully merging this pull request may close these issues.

4 participants