@@ -5,21 +5,35 @@ permalink: /404.html
5
5
---
6
6
7
7
<script language =" JavaScript " >
8
- var forwardingURL= window .location .pathname ;
9
- if (forwardingURL .charAt (forwardingURL .length - 1 ) != " /" ) forwardingURL += " /" ;
10
- var gonnaFwd = false ;
11
- var newURL = " " ;
12
- var baseURL = " " ;
13
- console .log (forwardingURL);
14
- {% for item in site .data .docsarchive .docker - compose % }
8
+ var forwardingURL= window .location .pathname ;
9
+ if (forwardingURL .charAt (forwardingURL .length - 1 ) != " /" ) forwardingURL += " /" ;
10
+ var gonnaFwd = false ;
11
+ var newURL = " " ;
12
+ var baseURL = " " ;
13
+ var archive = false ;
14
+ console .log (forwardingURL);
15
+
16
+ // .MD EXTENSION CHECK
17
+ if (forwardingURL .indexOf (" .md" ) > - 1 )
18
+ {
19
+ gonnaFwd = true ;
20
+ newURL = forwardingURL .replace (" .md" ," " );
21
+ } else {
22
+
23
+ // DOCS ARCHIVE CHECK
24
+ {% for item in site .data .docsarchive .docker - compose % }
15
25
if (forwardingURL .indexOf (" /{{ item[0] }}" ) > - 1 )
16
26
{
17
27
console .log (" Found via Docker Compose file for Acrhive" )
18
28
gonnaFwd = true ;
29
+ archive = true ;
19
30
// make it so redirects cascade; first, use the base URL, then append path
20
- baseURL = forwardingURL . replace ( " / {{ item[0] }} " , " {{ page.archiveserver }}:{{ item[1].ports[0] | replace:':4000','' }}" ) ;
21
- forwardingURL = forwardingURL .replace (" /{{ item[0] }}/ " ," " );
31
+ baseURL = " {{ page.archiveserver }}:{{ item[1].ports[0] | replace:':4000','' }}" ;
32
+ newURL = forwardingURL .replace (" /{{ item[0] }}" ," " );
22
33
}{% endfor % }
34
+
35
+ if (archive== false ) {
36
+ // CSV CHECK
23
37
{% for item in site .data .redirects % }
24
38
var redirectVal = {{ item | jsonify }};
25
39
if (forwardingURL == redirectVal .source )
@@ -28,8 +42,10 @@ permalink: /404.html
28
42
gonnaFwd = true ;
29
43
newURL = forwardingURL .replace (redirectVal .source ,redirectVal .destination );
30
44
}
31
- {% endfor % }
32
- {% for page in site .pages % }{% if page .aliases % }
45
+ {% endfor % }
46
+
47
+ // PAGE ALIASES CHECK
48
+ {% for page in site .pages % }{% if page .aliases % }
33
49
var aliases = {{ page .aliases | jsonify }};
34
50
if ( Object .prototype .toString .call ( aliases ) === ' [object Array]' ) {
35
51
// aliases is an array, therefore, there are multiple aliases
@@ -51,16 +67,20 @@ permalink: /404.html
51
67
newURL = " {{ page.url }}" ;
52
68
}
53
69
}
54
- {% endif % }{% endfor % }
55
- if (gonnaFwd) {
56
- newURL = baseURL + newURL;
57
- console .log (" Forwarding to: " + newURL);
58
- window .location .replace (newURL);
59
- window .location .href = newURL;
60
- document .write (' <meta http-equiv="refresh" content="0; url=' + newURL + ' ">' )
61
- } else {
62
- window .location .replace (" /sorry/#" + forwardingURL);
63
- window .location .href = " /sorry/#" + forwardingURL;
64
- document .write (' <meta http-equiv="refresh" content="0; url=/sorry/#' + forwardingURL + ' ">' )
65
- }
70
+ {% endif % }{% endfor % }
71
+
72
+ } // end of check for .md
73
+ } // end of check for archive
74
+
75
+ if (gonnaFwd) {
76
+ newURL = baseURL + newURL;
77
+ console .log (" Forwarding to: " + newURL);
78
+ window .location .replace (newURL);
79
+ window .location .href = newURL;
80
+ document .write (' <meta http-equiv="refresh" content="0; url=' + newURL + ' ">' )
81
+ } else {
82
+ window .location .replace (" /sorry/#" + forwardingURL);
83
+ window .location .href = " /sorry/#" + forwardingURL;
84
+ document .write (' <meta http-equiv="refresh" content="0; url=/sorry/#' + forwardingURL + ' ">' )
85
+ }
66
86
</script >
0 commit comments