Skip to content

Commit 067a2e3

Browse files
committed
Add a redirect at the top level of DocC output
Without a redirect, the server is generating an index page -- you have to click "the-swift-programming-language" to get to the book.
1 parent 8f7c1b7 commit 067a2e3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

bin/publish-book

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ cp -r bin/redirects/LanguageGuide "$output"
5252
cp -r bin/redirects/ReferenceManual "$output"
5353
cp -r bin/redirects/RevisionHistory "$output"
5454
cp -r bin/redirects/index.html "$output"
55+
56+
# Add a redirect page from swift.org/swift-book/documentation/.
57+
cp -r bin/redirects/documentation/index.html "$output/documentation/"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<html>
2+
<head>
3+
<title>The Swift Programming Language: Redirect</title>
4+
<meta http-equiv="refresh" content="10; url=https://docs.swift.org/swift-book/documentation/the-swift-programming-language/">
5+
<head>
6+
<body>
7+
<div>
8+
This content has moved; redirecting to the
9+
<a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/" id="redirect">new location</a>.
10+
<noscript>
11+
<aside>
12+
This page requires JavaScript.
13+
Please turn on JavaScript and refresh the page.
14+
</aside>
15+
</noscript>
16+
</div>
17+
<script>
18+
const baseURL = "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/";
19+
20+
var newURL = baseURL;
21+
22+
document.getElementById("redirect").setAttribute("href", newURL);
23+
window.location = newURL;
24+
</script>
25+
</body>
26+
</html>

0 commit comments

Comments
 (0)