Skip to content

Commit

Permalink
Add forwarding for page aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
johndmulhausen committed Oct 5, 2016
1 parent 2cd9cbd commit 9fd1c9a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 9fd1c9a

Please sign in to comment.