From 5eddf18e7b8f3abcfa5ca33bf6be99f40b367816 Mon Sep 17 00:00:00 2001 From: dav3exe Date: Mon, 30 Nov 2026 10:29:42 +0100 Subject: [PATCH] Homepage: drop the A to Z list of every game from the server-written page The homepage no longer lists every game by name (the website removes it too). /games and the sitemap still link every game. --- app/routers/pages.py | 9 +-------- tests/test_pages.py | 28 ++++++++-------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/app/routers/pages.py b/app/routers/pages.py index 0f0ecd1..5c8c16d 100644 --- a/app/routers/pages.py +++ b/app/routers/pages.py @@ -207,7 +207,6 @@ def indie_page(game_id: int = Path(ge=1, le=2_000_000_000), db: Session = Depend # home view in startng-fe (src/App.tsx, and the About and questions in src/home-copy.ts). HANGOUT = "hangout" # start.ng's own game has its own card, so it isn't in the community list HOME_GAMES = 8 # cards the homepage shows before "See all" (HOME_GAMES in src/App.tsx) -HOME_GAMES_LISTED = 200 # games listed by name, A to Z (AZ_GAMES in src/App.tsx) HOME_ABOUT = [ "start.ng is Nigeria's home for browser games, built by the HNG community. Every game is free to play in your " "browser with no download, and many are made in Naija: danfo rush hour, jollof catching, Lagos markets and more.", @@ -255,13 +254,7 @@ def _visible_games(db: Session) -> list[Game]: def _home_body(games: list[Game]) -> str: - listed = sorted(games, key=lambda g: _title(g.name).lower())[:HOME_GAMES_LISTED] total = len(games) - links = "".join( - f'
  • {_esc(_title(g.name))} by {_esc(_player_name(g.owner, "A builder"))}
  • ' - for g in listed - ) - az = f'
    Every game on start.ng, A to Z ({total})
    ' if games else "" see_all = f'
    See all {total} games →
    ' if total > HOME_GAMES else "" steps = "".join(f"
  • {_esc(t)}{text}
  • " for t, text in HOW_STEPS) about = "".join(f"

    {_esc(p)}

    " for p in HOME_ABOUT) + '

    More about start.ng →

    ' @@ -273,7 +266,7 @@ def _home_body(games: list[Game]) -> str: '

    Games made by builders in the community. Each one lives at its own start.ng address. ' "Pick one and play right in your browser.

    " '
    Play now
    ' - f'

    Games from the community

    {see_all}{az}
    ' + f'

    Games from the community

    {see_all}
    ' f'

    Got a game? Put it on start.ng

      {steps}
    ' '
    ' diff --git a/tests/test_pages.py b/tests/test_pages.py index f69b0a8..01fc9df 100644 --- a/tests/test_pages.py +++ b/tests/test_pages.py @@ -182,7 +182,7 @@ def test_one_indie_game_as_json_and_in_the_sitemap(env): assert f"https://start.ng/creators/{game_id}-moon-garden" in client.get("/pages/sitemap.xml").text -def test_homepage_text_lists_every_game_a_to_z(env): +def test_homepage_text_has_no_a_to_z_list_of_games(env): client, *_ = env add_game(env, "moon-garden") add_game(env, "lane-dash") @@ -192,14 +192,11 @@ def test_homepage_text_lists_every_game_a_to_z(env): text = res.text assert not text.startswith("Good vibes.
    Good games." in text - assert "Every game on start.ng, A to Z (2)" in text - lane, moon = text.index('Lane Dash'), text.index('Moon Garden') - assert lane < moon # A to Z - assert "by Ada" in text + assert "A to Z" not in text and "/games/lane-dash" not in text # removed from the homepage; /games and the sitemap list them assert "See all" not in text # only past the 8 cards the homepage shows -def test_homepage_text_leaves_out_hidden_games_and_the_hangout(env): +def test_homepage_see_all_leaves_out_hidden_games_and_the_hangout(env): from app.db import get_db from app.main import app @@ -209,24 +206,15 @@ def test_homepage_text_leaves_out_hidden_games_and_the_hangout(env): db = next(app.dependency_overrides[get_db]()) db.add(Game(name="copy-cat", owner_id=1, repo_url="https://github.com/ada/copy-cat", hidden="reported")) db.commit() - text = client.get("/pages/home").text - assert "/games/lane-dash" in text - assert "/games/hangout" not in text and "/games/copy-cat" not in text - assert "A to Z (1)" in text + for i in range(8): + add_game(env, f"game-{i}") + assert 'See all 9 games →' in client.get("/pages/home").text # lane-dash and 8 more -def test_homepage_text_has_the_about_and_questions_and_escapes_names(env): - from app.db import get_db - from app.main import app - from app.models import User - +def test_homepage_text_has_the_about_and_questions(env): client, *_ = env - db = next(app.dependency_overrides[get_db]()) - db.get(User, 1).character = {"name": "Ada Bold"} - db.commit() add_game(env, "lane-dash") text = client.get("/pages/home").text - assert "by Ada <b>Bold</b>" in text and "Bold" not in text assert "Nigeria's home for browser games" in text # escaped like every other text assert "Is it free?" in text assert 'Read the docs' in text @@ -235,7 +223,7 @@ def test_homepage_text_has_the_about_and_questions_and_escapes_names(env): def test_homepage_with_no_games_and_with_many(env): client, *_ = env - assert "A to Z" not in client.get("/pages/home").text # nothing to list yet + assert "See all" not in client.get("/pages/home").text # nothing to list yet for i in range(9): add_game(env, f"game-{i}") assert 'See all 9 games →' in client.get("/pages/home").text