-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path404.html
More file actions
94 lines (82 loc) · 2.9 KB
/
Copy path404.html
File metadata and controls
94 lines (82 loc) · 2.9 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv="Content-Security-Policy"
content="script-src 'nonce-aem' 'strict-dynamic'; base-uri 'self'; object-src 'none';"
move-to-http-header="true"
>
<title>Page not found</title>
<script nonce="aem" type="text/javascript">
window.isErrorPage = true;
window.errorCode = '404';
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Page not found">
<script nonce="aem" src="/scripts/scripts.js" type="module"></script>
<script nonce="aem" type="module">
import { sampleRUM, fetchPlaceholders } from '/scripts/aem.js';
import { getLocaleFromPath } from '/scripts/scripts.js';
const locale = getLocaleFromPath();
// Set home button href synchronously before any async work so the link is
// always correct regardless of how long fetchPlaceholders takes to resolve.
const homeBtn = document.querySelector('.error-button-home');
if (homeBtn) homeBtn.href = `/${locale}`;
const ph = await fetchPlaceholders(`/${locale}`);
// DOM is already parsed when a module runs, so no need to wait for 'load'
// to update content — except for sampleRUM which intentionally fires on load.
if (document.referrer) {
const { origin, pathname } = new URL(document.referrer);
if (origin === window.location.origin) {
const backBtn = document.createElement('a');
backBtn.classList.add('button', 'error-button-back');
backBtn.href = pathname;
backBtn.textContent = ph.goback || 'Go back';
backBtn.title = ph.goback || 'Go back';
const btnContainer = document.querySelector('.button-container');
if (btnContainer) btnContainer.append(backBtn);
}
}
if (ph.pagenotfound) {
const errorMessage = document.querySelector('.error-message');
if (errorMessage) errorMessage.textContent = ph.pagenotfound;
}
if (ph.gohome && homeBtn) {
homeBtn.textContent = ph.gohome;
}
window.addEventListener('load', () => {
sampleRUM('404', { source: document.referrer });
});
</script>
<link rel="stylesheet" href="/styles/styles.css">
<style>
main.error {
min-height: calc(100vh - var(--nav-height));
display: flex;
align-items: center;
}
main.error .error-number {
width: 100%;
}
main.error .error-number text {
font-family: var(--font-family-fixed);
}
</style>
<link rel="stylesheet" href="/styles/lazy-styles.css">
</head>
<body>
<header></header>
<main class="error">
<div class="section">
<svg viewBox="1 0 38 18" class="error-number">
<text x="0" y="17">404</text>
</svg>
<h2 class="error-message">Page Not Found</h2>
<p class="button-container">
<a href="/" class="button secondary error-button-home">Go home</a>
</p>
</div>
</main>
<footer></footer>
</body>
</html>