File tree Expand file tree Collapse file tree 4 files changed +39
-32
lines changed Expand file tree Collapse file tree 4 files changed +39
-32
lines changed Original file line number Diff line number Diff line change 11.page-not-found {
2- text-align : center;
3- margin : 50px ;
2+ display : flex;
3+ flex-direction : column;
4+ align-items : center;
5+ margin : 50px ;
46}
57
68.page-not-found h1 {
79 font-weight : normal;
10+ text-align : center;
811 font-size : 37px ;
912 margin : 30px 0 10px ;
1013}
11-
12- .page-not-found h2 {
13- font-weight : normal;
14- font-size : 30px ;
15- margin : 0 0 70px ;
16- }
17-
18- .page-not-found h3 {
19- font-weight : normal;
20- font-size : 25px ;
21- margin : 0 0 20px ;
22- color : var (--dark-grey );
23- }
24-
25- .page-not-found ul {
26- display : inline-flex;
27- list-style-type : none;
28- margin : 0 ;
29- }
30-
31- .page-not-found ul li {
32- padding : 0 30px ;
33- margin : 0 ;
34- }
35-
36- .page-not-found li + li {
37- border-left : 1px solid black;
38- }
Original file line number Diff line number Diff line change 1+ ( function ( global , doc ) {
2+ const errorPageContainer = doc . querySelector ( '.page-not-found' ) ;
3+
4+ if ( ! errorPageContainer ) {
5+ return ;
6+ }
7+
8+ // Replace all TOC links with the correct version
9+ let currentVersion = '5.0' ;
10+ const branchNameRegexp = / \/ e n \/ ( [ a - z 0 - 9 - _ .] * ) \/ / g. exec ( document . location . href ) ;
11+
12+ if ( branchNameRegexp !== null && branchNameRegexp . hasOwnProperty ( 1 ) && branchNameRegexp [ 1 ] . length ) {
13+ currentVersion = branchNameRegexp [ 1 ] ;
14+ }
15+
16+ doc . querySelectorAll ( '.md-sidebar--primary .md-nav__item a, .page-not-found a' ) . forEach ( link => {
17+ link . href = link . href . replace ( / \/ e n \/ ( [ a - z 0 - 9 - _ .] * ) \/ / , `/en/${ currentVersion } /` ) ;
18+ } ) ;
19+
20+ } ) ( window , window . document ) ;
Original file line number Diff line number Diff line change @@ -1005,6 +1005,7 @@ extra_javascript:
10051005 - js/jquery.min.js
10061006 - js/jquery-ui.min.js
10071007 - js/custom.js
1008+ - js/error-page.js
10081009 - js/release-notes.js
10091010 - js/docs.switcher.js
10101011 - ' //cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js'
Original file line number Diff line number Diff line change 22
33{% block content %}
44< div class ="page-not-found ">
5- < img src ="/images/404.png " alt ="Not found " />
65 < h1 > Page not found.</ h1 >
7- < a href ="/ "> Back to front page</ a >
6+ < img src ="/images/404.png " alt ="" />
7+ {% set site_url = config.site_url | default(nav.homepage.url, true) | url %}
8+ < p > This link might be out-of-date. Go to the < a href ="{{ site_url }} "> main documentation page</ a > or < a id ="search-link "href ="{{ site_url }}search_results/?sq=&p=1 "> use the search</ a > to find what you are looking for.</ p >
89</ div >
10+
11+ < script >
12+ // Get the actual 404 URL path and use it in initial search query
13+ const searchLink = document . querySelector ( '#search-link' ) ;
14+ const basePath = '{{ site_url }}' ;
15+ const suffix = window . location . href . substring ( basePath . length ) ;
16+ const searchQuery = suffix . replaceAll ( '/' , ' ' ) . replaceAll ( '_' , ' ' ) ;
17+ searchLink . href = searchLink . href . replace ( '?sq=' , '?sq=' + encodeURIComponent ( searchQuery ) ) ;
18+ </ script >
19+
920{% endblock %}
You can’t perform that action at this time.
0 commit comments