File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ layout: page
3+ title: 404 Page Not Found
4+ ---
5+ < script >
6+ var allposts = [ ] ;
7+ function redirectToCorrectPage ( ) {
8+ { % for post in site . pages % }
9+ allposts . push ( "{{ post.url }}" ) ;
10+ { % endfor % }
11+ { % for post in site . wikis % }
12+ allposts . push ( "{{ post.url }}" ) ;
13+ { % endfor % }
14+ var url = window . location . pathname ;
15+ // strip trailing /
16+ if ( url . slice ( - 1 ) === "/" ) {
17+ url = url . slice ( 0 , - 1 ) ;
18+ }
19+ var allpostsUpperCase = allposts . map ( function ( value ) {
20+ // strip trailing /
21+ if ( value . slice ( - 1 ) === "/" ) {
22+ value = value . slice ( 0 , - 1 ) ;
23+ }
24+ return value . toUpperCase ( ) ;
25+ } ) ;
26+ var i = allpostsUpperCase . indexOf ( url . toUpperCase ( ) ) ;
27+ if ( i != - 1 ) {
28+ console . log ( allposts [ i ] ) ;
29+ window . location = allposts [ i ] ;
30+ }
31+ }
32+ window . onload = redirectToCorrectPage ;
33+ </ script >
34+ < p > Sorry this page does not exist =(</ p >
Original file line number Diff line number Diff line change @@ -83,3 +83,4 @@ defaults:
8383 path : " " # empty string for all files
8484 values :
8585 layout : page
86+
You can’t perform that action at this time.
0 commit comments