diff --git a/404.md b/404.md index ee36caed4f..e3329eb792 100644 --- a/404.md +++ b/404.md @@ -11,6 +11,30 @@ function doFwd() { var portNumber = window.location.port; var gonnaFwd = false; var newURL = ""; + console.log(forwardingURL); + {% for page in site.pages %}{% if page.aliases %} + var aliases = {{ page.aliases | jsonify }}; + if( Object.prototype.toString.call( aliases ) === '[object Array]' ) { + // aliases is an array, therefore, there are multiple aliases + for (i=0; i< aliases.length; i++) + { + if (forwardingURL.indexOf(aliases[i]) > -1) + { + console.log("Found! ", forwardingURL.indexOf(aliases[i]), aliases[i]) + gonnaFwd = true; + newURL = "{{ page.url }}"; + } + } + } else { + // only one alias for this page. + if (forwardingURL.indexOf(aliases) > -1) + { + console.log("Found! ", forwardingURL.indexOf(aliases[i]), aliases[i]) + gonnaFwd = true; + newURL = "{{ page.url }}"; + } + } + {% endif %}{% endfor %} {% for item in site.data.docsarchive.docker-compose %} if (forwardingURL.indexOf("/{{ item[0] }}") > -1) {