From 3bae1a096425b1e1811256b56dad59dc613d8d22 Mon Sep 17 00:00:00 2001 From: Josh Collinsworth Date: Thu, 21 Nov 2024 15:47:06 -0600 Subject: [PATCH] Fix live 404 handling --- 404/index.page.tsx | 27 +++++++++++++++++++++------ middleware/redirects.ts | 9 +++++++++ styles.css | 18 ++++++++++++++++-- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/404/index.page.tsx b/404/index.page.tsx index f75958d8..d3800f19 100644 --- a/404/index.page.tsx +++ b/404/index.page.tsx @@ -18,11 +18,19 @@ const styles = /*css*/ ` margin-block-start: 0; } -#content nav :where(li, a, h2, button) { +#content nav :where(li, h2) { padding-inline-start: 0; + margin-inline: 0; text-wrap: balance; }`; +const scripts = /*js*/ ` + const searchParams = new URLSearchParams(document.location.search); + const pathParam = searchParams.get("path"); + const decodedPath = decodeURIComponent(pathParam); + document.getElementById("tried-path").innerText = decodedPath; +`; + export default function Page(props: Lume.Data, helpers: Lume.Helpers) { return (
-
-

- Sorry, couldn't find that page +
+

+ Sorry, couldn’t find that page.

-

- Maybe one of these links is what you're looking for? +

+ Failed to match route{" "} + + 404 + +

+

+ Maybe one of these links has what you're looking for?

+