From b6100bd2a8b318f193e9c9ae730bcad6b4fccee6 Mon Sep 17 00:00:00 2001 From: theoneand33 Date: Fri, 4 Sep 2026 14:09:56 +1200 Subject: [PATCH 1/2] feat: add 404 page, genre related games, responsive grid - Add 404 page with link back to all games - Rank More Games by same genre first - Fix tile and grid overflow on narrow screens --- src/components/gametile.astro | 4 ++-- src/layout/layout.astro | 12 ++++++++++-- src/pages/404.astro | 14 ++++++++++++++ src/pages/index.astro | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 src/pages/404.astro diff --git a/src/components/gametile.astro b/src/components/gametile.astro index 98d3938..91373c9 100644 --- a/src/components/gametile.astro +++ b/src/components/gametile.astro @@ -8,7 +8,7 @@ const { Game, Path, Image } = Astro.props; const altText = `${Game} unblocked - play online free`; --- - + {altText}

{Game}

diff --git a/src/layout/layout.astro b/src/layout/layout.astro index 8b42b86..40fefa7 100644 --- a/src/layout/layout.astro +++ b/src/layout/layout.astro @@ -43,8 +43,16 @@ const gameYear = seo?.year || ""; // URL const pageUrl = slug ? `${siteUrl}/games/${slug}` : siteUrl; -// More Games cross-linking — curated list of popular games -const moreGames = defaultGames.slice(0, MORE_GAMES_COUNT).filter((s) => s !== slug); // exclude current game +// More Games cross-linking — same genre first, then fill from popular +// ponytail: two passes over defaultGames, no new data structures +const moreGames = (() => { + if (!slug || !seo) return defaultGames.slice(0, MORE_GAMES_COUNT); + const rest = defaultGames.filter((s) => s !== slug); + return [ + ...rest.filter((s) => gamesMap[s].genre === seo.genre), + ...rest.filter((s) => gamesMap[s].genre !== seo.genre), + ].slice(0, MORE_GAMES_COUNT); +})(); --- diff --git a/src/pages/404.astro b/src/pages/404.astro new file mode 100644 index 0000000..5135057 --- /dev/null +++ b/src/pages/404.astro @@ -0,0 +1,14 @@ +--- +import Layout from "../layout/layout.astro"; +const pageTitle = "Page Not Found - Superfun Games"; +--- + + +
+

Game not found

+

+ That page doesn't exist. Pick a game below instead. +

+ Back to all games +
+
diff --git a/src/pages/index.astro b/src/pages/index.astro index 8f886a5..045c1d0 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -40,7 +40,7 @@ const popularGames = defaultGames.slice(0, POPULAR_COUNT);

All unblocked games

-
+
{ defaultGames.map((slug) => { const seo = gamesMap[slug]; From 4e2bbaa6ec9edc8277c9930ecef4824fcd28e8b4 Mon Sep 17 00:00:00 2001 From: theoneand33 Date: Fri, 4 Sep 2026 14:20:44 +1200 Subject: [PATCH 2/2] fix(layout): handle missing game in meta description fallback - Update 404 copy to point users back to homepage --- src/layout/layout.astro | 4 +++- src/pages/404.astro | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/layout/layout.astro b/src/layout/layout.astro index 40fefa7..81e83c9 100644 --- a/src/layout/layout.astro +++ b/src/layout/layout.astro @@ -30,7 +30,9 @@ const homeDescription = "Play free unblocked games on your school Chromebook - H const gameDescription = isHome ? homeDescription : seo?.description || - `Play ${Game} unblocked on your school Chromebook. No Flash plugin or download needed - runs directly in your browser. Fully working 2026 version of this classic game.`; + (Game + ? `Play ${Game} unblocked on your school Chromebook. No Flash plugin or download needed - runs directly in your browser. Fully working 2026 version of this classic game.` + : pageTitle || homeDescription); // Image & other SEO fields — ponytail: webp covers beat SVG for og:image validators const gameImage = isHome diff --git a/src/pages/404.astro b/src/pages/404.astro index 5135057..a6e52e8 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -7,7 +7,7 @@ const pageTitle = "Page Not Found - Superfun Games";

Game not found

- That page doesn't exist. Pick a game below instead. + That page doesn't exist. Head back to the homepage to pick a game.

Back to all games