Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions deploy_website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ cat README.md | grep -v 'project website' > docs/index.md
cp CHANGELOG.md docs/changelogs/changelog.md
cp CONTRIBUTING.md docs/contribute/contributing.md

# Create a redirect page for OkHttp 4.x API docs.
# The 4.x docs redirect to 5.x since the API surface is compatible.
mkdir -p docs/4.x/okhttp/okhttp3
cat > docs/4.x/okhttp/okhttp3/index.html << 'REDIRECT'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<script>
var path = window.location.pathname;
var idx = path.indexOf('/4.x/');
if (idx !== -1) {
window.location.replace(path.substring(0, idx) + '/5.x' + path.substring(idx + 4) + window.location.search + window.location.hash);
}
</script>
<meta http-equiv="refresh" content="0; url=../../5.x/okhttp/okhttp3/">
</head>
<body>
<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?


# Build the site and push the new files up to GitHub
python3 -m venv venv
source venv/bin/activate
Expand Down
18 changes: 18 additions & 0 deletions docs/4.x/okhttp/okhttp3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<script>
var path = window.location.pathname;
var idx = path.indexOf('/4.x/');
if (idx !== -1) {
window.location.replace(path.substring(0, idx) + '/5.x' + path.substring(idx + 4) + window.location.search + window.location.hash);
}
</script>
<meta http-equiv="refresh" content="0; url=../../5.x/okhttp/okhttp3/">
</head>
<body>
<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>
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ nav:
- 'Providers': security/security_providers.md
- 'Configuration History': security/tls_configuration_history.md
- 'Works with OkHttp': works_with_okhttp.md
- '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?

- 'Change Logs':
- 'Change Log': changelogs/changelog.md
- '4.x Change Log': changelogs/changelog_4x.md
Expand Down
24 changes: 24 additions & 0 deletions test_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,29 @@ cat README.md | grep -v 'project website' > docs/index.md
cp CHANGELOG.md docs/changelogs/changelog.md
cp CONTRIBUTING.md docs/contribute/contributing.md

# Create a redirect page for OkHttp 4.x API docs.
# The 4.x docs redirect to 5.x since the API surface is compatible.
mkdir -p docs/4.x/okhttp/okhttp3
cat > docs/4.x/okhttp/okhttp3/index.html << 'REDIRECT'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<script>
var path = window.location.pathname;
var idx = path.indexOf('/4.x/');
if (idx !== -1) {
window.location.replace(path.substring(0, idx) + '/5.x' + path.substring(idx + 4) + window.location.search + window.location.hash);
}
</script>
<meta http-equiv="refresh" content="0; url=../../5.x/okhttp/okhttp3/">
</head>
<body>
<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

# Build the site locally
mkdocs build