forked from jenkins-infra/jenkins.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path404.html.haml
73 lines (60 loc) · 1.53 KB
/
404.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
layout: default
title: Not Found
notitle: true
hideSearchBar: true
---
:css
.errorcontainer {
text-align: center;
}
.errorcontainer img {
max-width: 12%;
height: auto;
}
.searchcontainer {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
margin:10px;
}
.searchcontainer .DocSearch-Button{
width: 25%;
margin-bottom: 30px;
}
%div.errorcontainer
%img{:src => '/images/fire-jenkins.svg'}
%h3
The page you requested could not be found.
%p
%a{:href => "/"} Back to homepage
%div.searchcontainer
%h3
Search for related pages
:javascript
// fetch last segment from URL
const path = window.location.pathname;
const pathSegments = path.split('/').filter(Boolean);
const lastSegmentIndex = pathSegments.length - 1;
const lastSegment = pathSegments[lastSegmentIndex];
const div = document.createElement('div');
div.classList.add('searchcontainer');
const scriptFileEl = document.createElement('script');
scriptFileEl.setAttribute('defer', '');
scriptFileEl.setAttribute('src', `https://cdn.jsdelivr.net/npm/@docsearch/js@3`);
document.head.appendChild(scriptFileEl);
scriptFileEl.addEventListener('load', () => {
// enable docsearch
window.docsearch({
// point it at the renderroot
container: div,
indexName: 'jenkins',
appId: "M6L7Q4Z8HS",
apiKey: "52f8dfbff76ffd9106f1c68fee16154b",
searchParameters: {
},
initialQuery: lastSegment,
});
});
document.body.append(div);