From 564bfe8b1875cf3d560fcd1a48a0417eaf4b3f18 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:34:19 +0100 Subject: [PATCH] fix: describe platform pages by what they give The meta description of each platform page was its summary followed by the label of a link, "ROCKNIX website.", and never said the page gives the BIOS files, their folder and the install command. --- scripts/generate_site.py | 6 ++++++ tests/test_site_search.py | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 169842b1d..d48f812de 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -2516,6 +2516,12 @@ def _page_description(markdown: str, relative: Path, title: str) -> str: return _system_description(markdown, browser) if key.startswith("emulators/") and relative.stem != "index": return _emulator_description(markdown, key, title, _first_paragraph(lead)) + if key.startswith("platforms/") and relative.stem != "index": + # The summary ends on a link to the platform's site, whose label + # alone was left: "A system for handhelds. ROCKNIX website." + summary = _first_paragraph(lead).removesuffix(f" {title} website.") + return _shorten(f"The BIOS files for {title}, the folder they go in and the " + f"command that installs them. {summary}", 155) first = _first_paragraph(lead, minimum=35) questions = [_plain_markdown(re.sub(r"\s*\{[^}]*\}\s*$", "", heading)) for heading in re.findall(r"^## (.+\?)(?:[ \t]*\{[^}]*\})?[ \t]*$", markdown, re.M)] diff --git a/tests/test_site_search.py b/tests/test_site_search.py index e9705738d..32dbcd683 100644 --- a/tests/test_site_search.py +++ b/tests/test_site_search.py @@ -245,6 +245,16 @@ class Descriptions(unittest.TestCase): self.assertEqual(gs._page_description(body, key, "DaedalusX64"), "DaedalusX64 emulates Nintendo 64. Every file it reads comes with the app.") + def test_a_platform_page_says_what_it_gives(self) -> None: + """All 18 ended on the label of a link a snippet cannot follow, + "ROCKNIX website.", and never named the BIOS files or their folder.""" + body = ("# ROCKNIX\n\nA system for handhelds. [ROCKNIX website](https://rocknix.org).\n\n" + "## On the device { #install }\n") + self.assertEqual( + gs._page_description(body, Path("platforms/rocknix.md"), "ROCKNIX"), + "The BIOS files for ROCKNIX, the folder they go in and the command that installs " + "them. A system for handhelds.") + def test_a_console_page_is_described_by_its_start_line(self) -> None: body = "# Sega: Dreamcast\n\nPart of Sega.\n\n**Start with**: `dc_boot.bin`, `dc_flash.bin`.\n" text = gs._page_description(body, Path("systems/sega-dreamcast.md"), "Sega: Dreamcast")