-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(404): create error page from boilerplate
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Page not found</title> | ||
<script 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 src="/scripts/scripts.js" type="module" crossorigin="use-credentials"></script> | ||
<script type="module"> | ||
window.addEventListener('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 = 'Go back'; | ||
backBtn.title = 'Go back'; | ||
const btnContainer = document.querySelector('.button-container'); | ||
btnContainer.append(backBtn); | ||
} | ||
} | ||
}); | ||
</script> | ||
<script type="module"> | ||
import { sampleRUM } from '/scripts/lib-franklin.js'; | ||
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: monospace; | ||
} | ||
</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> |