From 587dc0c30cd2b42e384864788205f2c150a17f2b Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sat, 26 Aug 2023 17:07:28 +0100 Subject: Adds 404 page --- src/pages/404.astro | 7 +++++++ src/pages/[locale]/not-found.astro | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/pages/404.astro create mode 100644 src/pages/[locale]/not-found.astro (limited to 'src/pages') diff --git a/src/pages/404.astro b/src/pages/404.astro new file mode 100644 index 0000000..447a91e --- /dev/null +++ b/src/pages/404.astro @@ -0,0 +1,7 @@ +--- +import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath'; + +const locale = getLocaleFromPathOrThrow(Astro.url.pathname); +--- + + diff --git a/src/pages/[locale]/not-found.astro b/src/pages/[locale]/not-found.astro new file mode 100644 index 0000000..3b45ba0 --- /dev/null +++ b/src/pages/[locale]/not-found.astro @@ -0,0 +1,21 @@ +--- +import translate from '$i18n/translate'; +import tPage from '$i18n/translations/pages/404'; +import Page from '$layouts/Page.astro'; +import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath'; +import localeStaticPaths from '$lib/localeStaticPaths'; + +export async function getStaticPaths() { + return localeStaticPaths; +} + +const locale = getLocaleFromPathOrThrow(Astro.url.pathname); +const t = translate(locale); +--- + + +
+

{t(tPage, { key: 'title' })}

+

+

+
-- cgit v1.2.3