Fixes for forwarding, custom 404

This commit is contained in:
John Mulhausen 2016-09-29 19:39:14 -07:00
parent 1465790db0
commit b58c93bb40
3 changed files with 36 additions and 3 deletions

7
404.md
View File

@ -1,4 +1,5 @@
---
layout: null
permalink: /404.html
---
@ -16,10 +17,12 @@ function doFwd() {
console.log(domainName + ":"+ portNumber +"/{{ item[0] }}");
gonnaFwd = true;
if(forwardingURL.indexOf(":")>-1) {
if(portNumber.length > 0) {
console.log("Port!");
// there is a port number in the location; make sure to replace it
newURL = forwardingURL.replace(domainName + ":"+ portNumber +"/{{ item[0] }}","{{ page.archiveserver }}:{{ item[1].ports[0] | replace:':4000','' }}");
} else {
console.log("No port");
// no port number in the location; just foward them on
newURL = forwardingURL.replace(domainName + "/{{ item[0] }}","{{ page.archiveserver }}:{{ item[1].ports[0] | replace:':4000','' }}");
}
@ -29,7 +32,7 @@ function doFwd() {
console.log("Forwarding to: " + newURL);
window.location.replace(newURL);
} else {
document.getElementById("DocumentationText").innerHTML = "<h1>404</h1>Sorry, we can't find that page. Feel free to <a href='https://github.com/docker/docker.github.io/issues/new?title=404 at: " + forwardingURL + "&body=URL: "+ forwardingURL +"' class='nomunge'>file a ticket</a> and let us know!";
window.location.replace("/sorry/#" + forwardingURL);
}
}
window.onload = doFwd;

View File

@ -192,6 +192,7 @@ ng\:form {
<div {% if page.notoc %} class="col-xs-12 col-sm-9 col-md-10" {% else %} class="col-xs-12 col-sm-9 col-md-8 col-xl-9" {% endif %} >
<section class="section" id="DocumentationText">
{{ content }}
{% if page.noratings != true %}
<div style="text-align: center">
<img src="/images/chat.png" alt="chat icon" style="margin-right: 10px">
<b>Feedback?</b> Questions? Suggestions?<br/>
@ -207,8 +208,8 @@ ng\:form {
};
(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
</script>
</div>
{% endif %}
</section>
<script language="javascript">

29
sorry.md Normal file
View File

@ -0,0 +1,29 @@
---
title: "Sorry, we can't find that page :("
noratings: true
---
# Sorry, we can't find that page
<script language="JavaScript">
function populateTicket()
{
var output = new Array();
output.push("You can <a href='https://github.com/docker/docker.github.io/issues/new?title=404 at: ");
output.push(window.location.hash.replace("#",""));
output.push("&body=URL: ");
output.push(window.location.hash.replace("#",""));
output.push("' class='nomunge'>file a ticket</a> or <a href='/search/?q=");
output.push(window.location.hash.replace("#",""));
output.push("'>try a search</a>!");
document.getElementById("sorryMsg").innerHTML = output.join("");
}
window.onload = populateTicket;
</script>
<br/>
We tried to forward you to where we think you might be going, but we couldn't
find a good match.
<span id="sorryMsg" />