From 1647d0e4fbd7d8b35d25d033973ab33162e5a526 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Mon, 9 Nov 2026 10:59:12 +0100 Subject: [PATCH] feat: send alias profile pages to their emulator Search Console reported emulators/vba_m/ as not found: an alias profile has no page, and only the names in a profile's cores: list were redirected. Each of the 21 alias profiles now redirects to the page of the profile it names. --- scripts/sitestarlight.py | 10 +++++++++- tests/test_site_nav.py | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/sitestarlight.py b/scripts/sitestarlight.py index 3c4c54377..e8934b690 100644 --- a/scripts/sitestarlight.py +++ b/scripts/sitestarlight.py @@ -842,7 +842,8 @@ def redirects(profiles: dict, present: set[str], A page that moved, once its source is gone, and each name a profile's `cores:` gives the emulator (the buildbot's `mednafen_psx` for - beetle_psx), to the profile's page. A name two profiles claim, or one + beetle_psx), to the profile's page, and an alias profile's own name to + the page of the profile it is an alias of. A name two profiles claim, or one that is already a page's address, is left out. Addresses are written under the site root, without its base. ``moved`` adds pages that moved by generation, old page to new page, the new one with an optional @@ -863,6 +864,13 @@ def redirects(profiles: dict, present: set[str], name = str(name) if _CORE_NAME.fullmatch(name) and name != key: claims.setdefault(name, set()).add(key) + # An alias profile has no page of its own: its name is the address of + # the profile it designates (emulators/vba_m/ is VBA-M's, under vbam). + for key, profile in profiles.items(): + target = str(profile.get("alias_of") or "") + if (profile.get("type") == "alias" and _CORE_NAME.fullmatch(key) + and f"emulators/{target}.md" in present): + claims.setdefault(key, set()).add(target) for name, keys in sorted(claims.items()): if len(keys) == 1 and f"emulators/{name}.md".casefold() not in pages: out[address(f"emulators/{name}.md")] = address(f"emulators/{next(iter(keys))}.md") diff --git a/tests/test_site_nav.py b/tests/test_site_nav.py index 73bf5b4f4..7dc611aff 100644 --- a/tests/test_site_nav.py +++ b/tests/test_site_nav.py @@ -281,6 +281,14 @@ class Redirects(unittest.TestCase): "/wiki/getting-started/": "/which-pack/", }) + def test_an_alias_profile_leads_to_the_profile_it_names(self): + # Search Console found emulators/vba_m/ gone: vba_m is an alias of vbam. + profiles = {"vba_m": {"type": "alias", "alias_of": "vbam"}, "vbam": {"cores": []}, + "orphan": {"type": "alias", "alias_of": "nowhere"}} + present = {"emulators/vbam.md", "which-pack.md", "wiki/getting-started.md"} + self.assertEqual(sitestarlight.redirects(profiles, present), + {"/emulators/vba_m/": "/emulators/vbam/"}) + def test_a_moved_page_redirects_only_once_its_source_is_gone(self): present = {"wiki/getting-started.md", "which-pack.md"} self.assertEqual(sitestarlight.redirects({}, present), {})