Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src-11ty/404.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
layout: base.html
title: Page not found
description: The page you were looking for could not be found.
permalink: /404.html
---

<style>
.not-found {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 80px 20px;
max-width: 600px;
margin: 0 auto;
color: var(--app-text-primary);
}

.not-found .code {
font-size: 5rem;
font-weight: 700;
margin: 0;
line-height: 1;
color: var(--app-text-primary);
}

.not-found h1 {
font-size: 1.75rem;
margin: 16px 0 8px;
}

.not-found p {
color: var(--app-text-secondary);
line-height: 1.6;
margin: 0 0 24px;
}
</style>

<div class="not-found">
<p class="code">404</p>
<h1>Page not found</h1>
<p>The page you were looking for could not be found.</p>
<a href="/">Go back home</a>
</div>

<script>
document.addEventListener('DOMContentLoaded', function () {
plausible('404');
});
</script>
37 changes: 36 additions & 1 deletion src-11ty/_includes/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@
<meta property="og:type" content="website" />

<link rel="stylesheet" href="/src/styles/main.css" />

<!-- Plausible analytics -->
<script
async
src="https://plausible.openhomefoundation.org/js/pa-EkXAQjbzUhwwqEPi6iRK5.js"
></script>
<script>
window.plausible =
window.plausible ||
function () {
(plausible.q = plausible.q || []).push(arguments);
};
plausible.init =
plausible.init ||
function (i) {
plausible.o = i || {};
};
plausible.init();
</script>
</head>
<body class="wa-palette-shoelace wa-theme-shoelace">
<div class="app-header">
Expand All @@ -45,7 +64,7 @@
class="nav-link"
target="_blank"
>
OHF
Open Home Foundation
</a>
<a
href="https://www.home-assistant.io/"
Expand All @@ -58,6 +77,22 @@
</header>
</div>
{{ content | safe }}
<footer class="app-footer">
<p>
This website uses
<a
href="https://www.openhomefoundation.org/blog/making-our-web-analytics-open-source-with-plausible/"
rel="noopener"
>privacy-first analytics</a
>
to help us improve the site. You can view all data in our
<a
href="https://plausible.openhomefoundation.org/toolbox.openhomefoundation.org"
rel="noopener"
>public dashboard</a
>.
</p>
</footer>
<script>
(function () {
const updateTheme = () => {
Expand Down
19 changes: 19 additions & 0 deletions src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,22 @@ body {
width: 14px;
height: 14px;
}

.app-footer {
text-align: center;
padding: 24px 20px;
}

.app-footer p {
margin: 0 auto;
max-width: 30rem;
font-size: 0.8rem;
color: var(--app-text-secondary);
line-height: 1.5;
text-wrap: balance;
}

.app-footer a {
color: var(--wa-color-brand-50);
}

4 changes: 4 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export default defineConfig({
);
if (fs.existsSync(indexPath)) {
req.url = req.url + '/index.html';
} else {
// Unknown route: serve the 404 page
req.url = '/404.html';
}
}
}
Expand All @@ -65,6 +68,7 @@ export default defineConfig({
rollupOptions: {
input: {
main: resolve(__dirname, 'dist/index.html'),
notFound: resolve(__dirname, 'dist/404.html'),
homeAssistantVoicePreviewEdition: resolve(
__dirname,
'dist/home-assistant-voice-preview-edition/index.html'
Expand Down
Loading