Skip to content

Commit 9902ceb

Browse files
author
Misty Stanley-Jones
authored
Improve the 404 page (docker#2550)
- Don't actually change the URL - Give more choices about what to do in the event of a 404
1 parent bfca277 commit 9902ceb

File tree

2 files changed

+29
-34
lines changed

2 files changed

+29
-34
lines changed

404.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
2-
layout: null
3-
title: 404 Redirector
2+
title: "Sorry, we can't find that page"
43
permalink: /404.html
4+
noratings: true
5+
notoc: true
6+
tree: false
57
---
68

79
<script language="JavaScript">
@@ -71,6 +73,8 @@ if (archive==false) {
7173

7274
} // end of check for .md
7375
} // end of check for archive
76+
var path = window.location.pathname.replace("#","");
77+
var phrase = decodeURIComponent(path.replace(/\/+/g, ' ').trim());
7478

7579
if (gonnaFwd) {
7680
newURL = baseURL + newURL;
@@ -79,8 +83,28 @@ if (gonnaFwd) {
7983
window.location.href = newURL;
8084
document.write('<meta http-equiv="refresh" content="0; url=' + newURL + '">')
8185
} else {
82-
window.location.replace("/sorry/#" + forwardingURL);
83-
window.location.href = "/sorry/#" + forwardingURL;
84-
document.write('<meta http-equiv="refresh" content="0; url=/sorry/#' + forwardingURL + '">')
86+
function populateTicket()
87+
{
88+
var searchVal = phrase;
89+
var output = new Array();
90+
output.push("<ul><li><a href='https://github.com/docker/docker.github.io/issues/new?title=404 at: ");
91+
output.push(path);
92+
output.push("&body=URL: ");
93+
output.push(path);
94+
output.push("' class='nomunge'>File a ticket</a></li>");
95+
output.push("<li><a href='/search/?q=" + phrase + "'</a>Search for <tt>&quot;" + phrase + "&quot;</tt></a></li>");
96+
output.push("<li><a href='/search/'>Try a different search</a></li>");
97+
output.push("<li><a href='/'>Go to the index</a></li></ul><br />");
98+
document.getElementById("sorryMsg").innerHTML = output.join("");
99+
}
100+
window.onload = populateTicket;
85101
}
86102
</script>
103+
104+
<br/>
105+
106+
We tried to forward you to where we think you might be going, but we couldn't
107+
find a good match. You've got some choices:
108+
109+
<span id="sorryMsg" />
110+

sorry.md

-29
This file was deleted.

0 commit comments

Comments
 (0)