docs: redirect 4.x API doc URLs to 5.x#9396
Open
faraz152 wants to merge 1 commit intosquare:masterfrom
Open
Conversation
The 4.x API docs were never published to the gh-pages branch, so all /okhttp/4.x/ URLs return 404. Since 5.x is the direct successor with the same package structure (okhttp3), redirect /4.x/ paths to the corresponding /5.x/ path. Both deploy_website.sh and test_docs.sh now generate a 4.x/ redirect page during the docs build. Fixes square#9156
|
To me, redirecting 4.x documentation to 5.x seems inappropriate and confusing. OkHttp 5.x is not OkHttp 4.x, so their documentation is not interchangeable. |
Author
|
Good point — a silent redirect could be confusing since the APIs differ between 4.x and 5.x. Happy to change the approach. Should I instead show a notice page explaining that 4.x API docs aren't published separately, with a link to 5.x as a reference? Or would generating actual 4.x docs from the 4.12.0 tag be preferred? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #9156 — all
/okhttp/4.x/URLs on the project website return 404 because the 4.x API docs were never published to gh-pages. Pages like/features/caching/that link to/okhttp/4.x/okhttp/okhttp3/-cache/are broken.Changes
Both
deploy_website.shandtest_docs.shnow generate adocs/4.x/index.htmlredirect page during the docs build. The redirect:window.location.replace()to map/4.x/<path>→/5.x/<path>(preserving sub-paths and hash fragments)<meta http-equiv="refresh">for non-JS browsersThis works because 5.x is the direct successor to 4.x with the same
okhttp3package structure.What's on gh-pages today
After this PR,
4.x/will contain a redirect page pointing to5.x/.Testing
curl -s -o /dev/null -w "%{http_code}" https://square.github.io/okhttp/4.x/okhttp/okhttp3/-cache/returns 404curl -s -o /dev/null -w "%{http_code}" https://square.github.io/okhttp/5.x/okhttp/okhttp3/-cache/returns 200deploy_website.shandtest_docs.shboth produce the redirect indocs/4.x/