diff --git a/astro/src/pages/404.astro b/astro/src/pages/404.astro index 17522fe..dd154a3 100644 --- a/astro/src/pages/404.astro +++ b/astro/src/pages/404.astro @@ -1,15 +1,24 @@ --- import Base from '../layouts/Base.astro'; +import { getCollection } from 'astro:content'; -const gearSvg = ` +const extensions = await getCollection('extensions'); + +// Pick 2 random extensions +const shuffled = [...extensions].sort(() => Math.random() - 0.5); +const randomExts = shuffled.slice(0, 2); + +const gearSvg = ` - - - + + + - - clack + + + + `; --- @@ -34,6 +43,24 @@ const gearSvg = ` try { find('/page') } catch (GearStrippedError) { redirect('/') } + + {randomExts.length > 0 && ( +
+

While you're here, check these out

+
+ {randomExts.map((ext) => ( +
+ {ext.slug} +

{ext.data.name}

+

{ext.data.tagline}

+ +
+ ))} +
+
+ )} @@ -49,26 +76,45 @@ const gearSvg = ` +const gearSvg = ` - - - + + + - - - - - - - + + + + + + + + `; --- @@ -58,35 +59,37 @@ const gearSvg = `