mirror of
https://github.com/docker/docs.git
synced 2026-03-27 06:18:55 +07:00
Clean up 404 page
This commit is contained in:
committed by
Joao Fernandes
parent
572869c3a1
commit
da719af9f4
60
404.md
60
404.md
@@ -6,59 +6,11 @@ notoc: true
|
||||
tree: false
|
||||
---
|
||||
|
||||
<br/>
|
||||
It seems the page you're looking for doesn't exist. Maybe you're on the wrong
|
||||
track, maybe you found a broken link. Who knows?
|
||||
|
||||
We tried to forward you to where we think you might be going, but we couldn't
|
||||
find a good match. You've got some choices:
|
||||
Either way, here's a couple of options for you:
|
||||
|
||||
<div id="sorryMsg"></div>
|
||||
|
||||
<!-- Script needs to be at the bottom, after any content -->
|
||||
<script language="JavaScript">
|
||||
var forwardingURL=window.location.pathname;
|
||||
if (forwardingURL.charAt(forwardingURL.length - 1) != "/") forwardingURL += "/";
|
||||
var gonnaFwd = false;
|
||||
var newURL = "";
|
||||
var baseURL = "";
|
||||
var archive = false;
|
||||
console.log(forwardingURL);
|
||||
|
||||
// .MD EXTENSION CHECK
|
||||
if (forwardingURL.indexOf(".md") > -1)
|
||||
{
|
||||
gonnaFwd = true;
|
||||
newURL = forwardingURL.replace(".md","") + location.hash;
|
||||
} else {
|
||||
|
||||
// CSV CHECK
|
||||
{% for item in site.data.redirects %}
|
||||
var redirectVal = {{ item | jsonify }};
|
||||
if (forwardingURL == redirectVal.source)
|
||||
{
|
||||
console.log("Found via CSV @ ", redirectVal.source, redirectVal.destination);
|
||||
gonnaFwd = true;
|
||||
newURL = forwardingURL.replace(redirectVal.source,redirectVal.destination);
|
||||
}
|
||||
{% endfor %}
|
||||
} // end of check for .md
|
||||
|
||||
var path = window.location.pathname.replace("#","");
|
||||
var phrase = decodeURIComponent(path.replace(/\/+/g, ' ').trim());
|
||||
|
||||
if (gonnaFwd) {
|
||||
newURL = baseURL + newURL;
|
||||
console.log("Forwarding to: " + newURL);
|
||||
window.location.replace(newURL);
|
||||
window.location.href = newURL;
|
||||
document.write('<meta http-equiv="refresh" content="0; url=' + newURL + '">')
|
||||
} else {
|
||||
console.log("Showing 404 choices");
|
||||
var ghIssueQueryString = "title=404%20at%20" + path + "&body=URL%3A%20" + path;
|
||||
var output = new Array();
|
||||
output.push("<ul><li><a href='https://github.com/docker/docker.github.io/issues/new?" + ghIssueQueryString + "' class='nomunge'>File a ticket</a></li>");
|
||||
output.push("<li><a href='/search/?q=" + phrase + "'</a>Search for <tt>"" + phrase + ""</tt></a></li>");
|
||||
output.push("<li><a href='/search/'>Try a different search</a></li>");
|
||||
output.push("<li><a href='/'>Go to the index</a></li></ul>");
|
||||
document.getElementById('sorryMsg').innerHTML = output.join("");
|
||||
}
|
||||
</script>
|
||||
* [Open an issue](https://github.com/docker/docker.github.io/issues/new?title=I%20found%20a%20broken%20link&body=%3CDescribe%20how%20you%20got%20there%3E)
|
||||
* [Go to back](/)
|
||||
* [Tweet us something](https://twitter.com/docker)
|
||||
|
||||
Reference in New Issue
Block a user