docs/404.md

78 lines
2.5 KiB
Markdown

---
title: "Sorry, we can't find that page"
permalink: /404.html
noratings: true
notoc: true
tree: false
---
<br/>
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:
<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","");
} else {
// DOCS ARCHIVE CHECK
{% for item in site.data.docsarchive.docker-compose %}
if (forwardingURL == "/{{ item[0] }}/")
{
console.log("Found via Docker Compose file for Archive");
gonnaFwd = true;
archive = true;
// make it so redirects cascade; first, use the base URL, then append path
baseURL = "{{ site.url }}";
newURL = forwardingURL;
}{% endfor %}
if (archive==false) {
// 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 archive
} // 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>&quot;" + phrase + "&quot;</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>