Skip to content

fix missing 4.x doc links#9510

Open
GautamKumarOffical wants to merge 1 commit into
square:masterfrom
GautamKumarOffical:fix/missing-4x-docs
Open

fix missing 4.x doc links#9510
GautamKumarOffical wants to merge 1 commit into
square:masterfrom
GautamKumarOffical:fix/missing-4x-docs

Conversation

@GautamKumarOffical

Copy link
Copy Markdown

Fixes #9156

The site nav only linked to 5.x API docs with no 4.x entry, and there was no redirect fallback for old /4.x/ URLs. Users following old links or bookmarks to 4.x API docs would get 404s.

Changes:

  • Added a 4.x entry under the API nav in mkdocs.yml alongside 5.x
  • Both deploy_website.sh and test_docs.sh now generate a docs/4.x/ redirect page that maps /4.x/*/5.x/* using JS + meta refresh fallback
  • The redirect page is also committed as a static file in docs/4.x/okhttp/okhttp3/index.html
  • On the deployed site, the gh-pages cherry-picks will overlay the real 4.x Dokka docs on top of this redirect

The site nav only linked to 5.x API docs, and there was no fallback
for 4.x URLs. Users following old links to /4.x/okhttp/okhttp3/
would hit dead ends.

- Add 4.x API entry to mkdocs.yml nav alongside 5.x
- Generate a redirect page (docs/4.x/) in both deploy_website.sh
  and test_docs.sh that maps /4.x/* paths to their 5.x equivalents
- Works with both JS-enabled and no-JS browsers (meta refresh fallback)

Fixes square#9156
@GautamKumarOffical GautamKumarOffical changed the title "fix-missing-4x-doc-links" fix missing 4.x doc links Jun 25, 2026
Comment thread deploy_website.sh
<p>OkHttp 4.x API docs have moved. Redirecting to <a href="../../5.x/okhttp/okhttp3/">5.x API docs</a>&hellip;</p>
</body>
</html>
REDIRECT

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are we writing the same code out here and below if it's also checked in?

Comment thread mkdocs.yml
- 'API': 5.x/okhttp/okhttp3/
- 'API':
- '5.x': 5.x/okhttp/okhttp3/
- '4.x': 4.x/okhttp/okhttp3/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why would we link to the 4.x docs if it's going to immediately redirect to the 5.x ones?

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.

Missing documentation for OkHttp 4.x

2 participants