From e7c4de27bca3d71cd17e7d816a46a0e9041d0d9b Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:17:19 +0100 Subject: [PATCH 1/2] fix: lead the old oric address to tangerine A reader followed /systems/oric/ to the 404 page: Oric has been filed under its maker since 2026-10-23. --- scripts/generate_site.py | 3 +++ tests/test_site_systems.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 22ac647b6..a81e40523 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -7397,6 +7397,9 @@ SYSTEM_PAGES_MOVED = { "systems/arcade-sharp-mz-2500.md": "systems/sharp.md", "systems/arcade-miuchiz.md": "systems/arcade.md", "systems/arcade-yamaha-ym2608.md": "systems/arcade.md", + # Oric is filed under its maker since 2026-10-23, and a reader still + # followed the old address to the 404 page. + "systems/oric.md": "systems/tangerine.md#oric", "systems/other-scummvm.md": "systems/scummvm.md", "systems/other-sdlpal.md": "systems/sdlpal.md", "systems/sega-dreamcast.md": "systems/sega.md", diff --git a/tests/test_site_systems.py b/tests/test_site_systems.py index 9f8891799..c1c0946c1 100644 --- a/tests/test_site_systems.py +++ b/tests/test_site_systems.py @@ -1187,7 +1187,8 @@ class EnginesGoByEngine(unittest.TestCase): def test_moved_pages_redirect(self) -> None: if not SYSTEMS.is_dir(): self.skipTest("pages not generated") - for old, new in gs.SYSTEM_PAGES_MOVED.items(): + for old, target in gs.SYSTEM_PAGES_MOVED.items(): + new = target.partition("#")[0] self.assertFalse((CONTENT / old).exists() or (CONTENT / old).with_suffix(".mdx").exists(), old) # A page with tabs is written as MDX. self.assertTrue((CONTENT / new).exists() or (CONTENT / new).with_suffix(".mdx").exists(), new) @@ -1195,6 +1196,7 @@ class EnginesGoByEngine(unittest.TestCase): if redirects.is_file(): table = json.loads(redirects.read_text(encoding="utf-8")) self.assertEqual(table.get("/systems/other-scummvm/"), "/systems/scummvm/") + self.assertEqual(table.get("/systems/oric/"), "/systems/tangerine/#oric") class OneLabelOnceOnABoardPage(unittest.TestCase): From 4ac3f7de71d879ce29dd3fad1299d3cc6450b4c1 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:17:19 +0100 Subject: [PATCH 2/2] fix: count clicks apart from direct visits GoatCounter files an action as a direct visit: the report subtracts them and states page views and actions apart. --- scripts/site_insights.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/site_insights.py b/scripts/site_insights.py index ec6949f66..f9edc0bfa 100644 --- a/scripts/site_insights.py +++ b/scripts/site_insights.py @@ -139,8 +139,14 @@ def fetch_goatcounter(start: dt.date, end: dt.date) -> dict[str, list[tuple[str, if not answer.get("more"): break refs = _get_json(f"{GOATCOUNTER}/stats/toprefs?{urllib.parse.urlencode({**span, 'limit': 50})}", auth) - referrers = [(r.get("name") or "(direct)", int(r["count"])) for r in refs.get("stats", [])] - return {"hits": hits, "referrers": referrers} + total = _get_json(f"{GOATCOUNTER}/stats/total?{urllib.parse.urlencode(span)}", auth) + # An action carries no referrer, and GoatCounter files it as a direct + # visit: 592 of the first day's 1,145 "direct" were clicks. + events = int(total.get("total_events", 0)) + referrers = [("(direct)", max(int(r["count"]) - events, 0)) if not r.get("name") else (r["name"], int(r["count"])) + for r in refs.get("stats", [])] + return {"hits": hits, "referrers": sorted(referrers, key=lambda row: -row[1]), + "visits": int(total.get("total", 0)) - events, "actions": events} def fetch_github() -> dict: @@ -246,7 +252,8 @@ def report(start: dt.date, end: dt.date, queries: list[Query] | None, goat: dict "helpful": "Did this page help?", "get": "Pack pages opened", "download": "Release downloads", "file": "File downloads", "copy": "Copy buttons", "out": "Links leaving the site", "pages": "Pages"} - out += ["## On the site", ""] + out += ["## On the site", "", + f"{goat.get('visits', 0):,} page views, {goat.get('actions', 0):,} actions.", ""] for kind, title in named.items(): if kind in actions: out += [f"### {title}", "", *_table(("Name", "Visits"), [(n, f"{c:,}") for n, c in actions[kind]])]