Skip to content

Commit 53ba929

Browse files
committed
404: also be more helpful about non-existing book pages
Just like was just done for non-existing documentation pages, let's be more helpful for missing book pages, too. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent dd062e2 commit 53ba929

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

content/404.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>That page doesn't exist.</h1>
1212
</p>
1313
<script>
1414
/* Be more helpful for outdated manual versions */
15-
const match = window.location.pathname.match(/^(.*\/docs\/([^/]*))\/([0-9.]*)$/)
15+
let match = window.location.pathname.match(/^(.*\/docs\/([^/]*))\/([0-9.]*)$/)
1616
if (match) {
1717
const [, path, command, version] = match
1818

@@ -57,5 +57,14 @@ <h1>That page doesn't exist.</h1>
5757
}">${versions[i]}</a>.`
5858
})().catch(console.error)
5959
}
60+
61+
match = window.location.pathname.match(/^(.*\/book\/([^/]*))(\/.*)$/)
62+
if (match) {
63+
const [, path, rest] = match
64+
65+
const el = document.querySelector('#explanation')
66+
el.innerHTML = `This book page was not found. <a href="${
67+
path}${window.location.search}${window.location.hash
68+
}">The book's front page is here</a>.`
6069
</script>
6170
</div>

0 commit comments

Comments
 (0)