Skip to content

Commit

Permalink
make 404 code more like cigaradvisor
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeffleyfamous committed May 8, 2024
1 parent 6c0d527 commit b9d8127
Showing 1 changed file with 14 additions and 47 deletions.
61 changes: 14 additions & 47 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,28 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Page not found">
<script src="/best-cigars-guide/scripts/scripts.js" type="module" crossorigin="use-credentials"></script>
<link rel="stylesheet" href="/best-cigars-guide/styles/styles.css">
<script type="module">
import { sampleRUM } from '/best-cigars-guide/scripts/aem.js';
import { loadFragment } from '/best-cigars-guide/blocks/fragment/fragment.js';

window.addEventListener('load', async() => {
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);
}
}
sampleRUM('404', { source: document.referrer, target: window.location.href });
const main = document.querySelector('main');
main.replaceWith(await loadFragment('/best-cigars-guide/fragments/404'));
});
</script>
<link rel="stylesheet" href="/best-cigars-guide/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(--fixed-font-family);
}
</style>
<link rel="stylesheet" href="/best-cigars-guide/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>
<body class="under-nav">
<header></header>
<main class="error">
<div>
<div class="fragment">
<div>path</div>
<div>
<a href="/best-cigars-guide/fragments/404"></a>
</div>
</div>
</main>
<footer></footer>
</div>
</main>
<footer></footer>
</body>

</html>
</html>

0 comments on commit b9d8127

Please sign in to comment.