From af2c4b358903721e5d1d6f9fcab934503473b27b Mon Sep 17 00:00:00 2001 From: Arshdeep singh Date: Mon, 14 Sep 2026 22:12:37 +0530 Subject: [PATCH 1/2] docs: redirect hash api-reference to API Reference #api-reference (no slash) missed the legacy hash rules and fell through to Quickstart. Treat it like /api-reference. Co-authored-by: Cursor --- tests/docs-site.spec.ts | 6 ++++++ zudoku.config.tsx | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/docs-site.spec.ts b/tests/docs-site.spec.ts index 55d0af3..ad9778a 100644 --- a/tests/docs-site.spec.ts +++ b/tests/docs-site.spec.ts @@ -394,6 +394,12 @@ test("bridges legacy hash routes to clean URLs", async ({ page }) => { await page.goto("/#/api-reference"); await expect(page).toHaveURL(/\/api-reference(?:\/calls)?$/); + + await page.goto("/#api-reference"); + await expect(page).toHaveURL(/\/api-reference(?:\/calls)?$/); + + await page.goto("/#not-a-docs-route"); + await expect(page).not.toHaveURL(/\/quickstart/); }); test("renders every migrated guide from its file route", async ({ page }) => { diff --git a/zudoku.config.tsx b/zudoku.config.tsx index 050d810..f2def57 100644 --- a/zudoku.config.tsx +++ b/zudoku.config.tsx @@ -7,7 +7,8 @@ const legacyHashRedirect = ` (() => { if (window.location.pathname !== "/") return; - const [route, query = ""] = window.location.hash.slice(1).split("?", 2); + const [rawRoute, query = ""] = window.location.hash.slice(1).split("?", 2); + const route = rawRoute.startsWith("/") || rawRoute === "" ? rawRoute : \`/\${rawRoute}\`; const guideRoutes = new Set([ "/quickstart", "/authentication", @@ -31,15 +32,20 @@ const legacyHashRedirect = ` if ( route === "/api-reference" || route.startsWith("/api-1/") || + route.startsWith("/tag/") || route.startsWith("tag/") || + route.startsWith("/description/") || route.startsWith("description/") || + route === "/models" || route === "models" ) { window.location.replace("/api-reference"); return; } - window.location.replace("/quickstart"); + if (rawRoute === "") { + window.location.replace("/quickstart"); + } })(); `; From 2a0e74bba07c0697679234aa53f57bc9720ae105 Mon Sep 17 00:00:00 2001 From: "J.Jason" <130959319+JJasonSun@users.noreply.github.com> Date: Tue, 15 Sep 2026 17:41:26 +0800 Subject: [PATCH 2/2] fix: complete legacy hash redirect coverage --- tests/docs-site.spec.ts | 22 +++++++++++++++++++--- zudoku.config.tsx | 5 +---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/docs-site.spec.ts b/tests/docs-site.spec.ts index d4df9ef..cbf2322 100644 --- a/tests/docs-site.spec.ts +++ b/tests/docs-site.spec.ts @@ -395,11 +395,27 @@ test("bridges legacy hash routes to clean URLs", async ({ page }) => { await page.goto("/#/api-reference"); await expect(page).toHaveURL(/\/api-reference(?:\/calls)?$/); - await page.goto("/#api-reference"); - await expect(page).toHaveURL(/\/api-reference(?:\/calls)?$/); + for (const hash of [ + "api-reference", + "tag/Calls", + "/tag/Calls", + "description/auth", + "/description/auth", + "models", + "/models", + ]) { + await page.goto(`/#${hash}`); + await expect(page).toHaveURL(/\/api-reference(?:\/calls)?$/); + } + + await page.goto("/#calls?section=idempotency"); + await expect(page).toHaveURL(/\/calls#idempotency$/); + + await page.goto("/"); + await expect(page).toHaveURL(/\/quickstart$/); await page.goto("/#not-a-docs-route"); - await expect(page).not.toHaveURL(/\/quickstart/); + await expect(page).toHaveURL(/\/#not-a-docs-route$/); }); test("renders every migrated guide from its file route", async ({ page }) => { diff --git a/zudoku.config.tsx b/zudoku.config.tsx index f2def57..0b547f9 100644 --- a/zudoku.config.tsx +++ b/zudoku.config.tsx @@ -33,11 +33,8 @@ const legacyHashRedirect = ` route === "/api-reference" || route.startsWith("/api-1/") || route.startsWith("/tag/") || - route.startsWith("tag/") || route.startsWith("/description/") || - route.startsWith("description/") || - route === "/models" || - route === "models" + route === "/models" ) { window.location.replace("/api-reference"); return;