File tree Expand file tree Collapse file tree 4 files changed +39
-38
lines changed Expand file tree Collapse file tree 4 files changed +39
-38
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 @@ -215,6 +215,7 @@ extra_javascript:
215215 - js/jquery.min.js
216216 - js/jquery-ui.min.js
217217 - js/custom.js
218+ - js/error-page.js
218219 - js/docs.switcher.js
219220 - ' //cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js'
220221
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- < h2 > You probably weren't expecting to land here.</ h2 >
8- < h3 > Here are some useful links instead:</ h3 >
9- < ul >
10- < li > < a href ="/projects/userguide/en/latest/persona_paths/author_content/ "> Creating content</ a > </ li >
11- < li > < a href ="/projects/userguide/en/latest/persona_paths/publish_content/ "> Publishing content</ a > </ li >
12- < li > < a href ="/projects/userguide/en/latest/search/search_for_content/ "> Searching for content</ a > </ li >
13- </ ul >
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 >
149</ 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+
1520{% endblock %}
You can’t perform that action at this time.
0 commit comments