@@ -3,50 +3,37 @@ import Layout from "../layouts/BaseLayout.astro";
33
44/**
55 * Returns the last (non-empty) segment from the slash-separated path, or ""
6- *
6+ *
77 * @param path string to extract the last part of
88 * @returns the last non-empty segment or an empty string
9- *
10- * @example
9+ *
10+ * @example
1111 * an input of `/reference/p5/basematerialshader/` will return `basematerialshader`
1212 */
1313function getLastPathElementOrEmptyString(path : string ): string {
1414 return path .split (" /" ).filter (Boolean ).pop () ?? " " ;
1515}
1616
17-
1817const currentPath = Astro .url .pathname ;
1918const finalTerm = getLastPathElementOrEmptyString (currentPath );
2019---
2120
2221<Layout title =" 404: Page Not Found" >
23- <main class =" error-container" >
24- <p >Sorry, we couldn't find your exact page <code >{ currentPath } </code >.</p >
22+ <main class =" flex flex-col items-start gap-8 py-8 px-2 prose max-w-none" >
23+ <p >
24+ Sorry, we couldn't find your exact page
25+ <code >{ currentPath } </code >.
2526
26- <div class =" actions" >
27- <a
28- href ={ ` https://beta.p5js.org/search/?term=${finalTerm } ` }
29- class =" btn secondary"
30- >
31- Search here for <code >{ finalTerm } </code >
32- </a >
33- or
34- <a href =" /" class =" btn" >go home</a >
35- </div >
27+ <div class =" flex flex-col gap-4" >
28+ <a
29+ href ={ ` https://beta.p5js.org/search/?term=${finalTerm } ` }
30+ class =" btn"
31+ >
32+ Search here for <code >{ finalTerm } </code >
33+ </a >
34+ or
35+ <a href =" /" class =" btn secondary" >go home</a >
36+ </div >
37+ </p >
3638 </main >
3739</Layout >
38- <style >
39- .error-container {
40- display: flex;
41- flex-direction:column;
42- align-items: flex-start;
43- padding: 2rem 1rem;
44- gap: 2rem;
45- }
46- .actions {
47- display: flex;
48- flex-direction: column;
49- gap: 1rem;
50- justify-content: center;
51- }
52- </style >
0 commit comments