docs: redirect legacy cube.dev/docs URLs to new docs.cube.dev#11002
Conversation
The new Mintlify docs are served at docs.cube.dev. The old Next.js/Nextra site at cube.dev/docs now issues cross-domain 301s to it so legacy URLs and inbound links keep resolving. - Add build_old_site_redirects.py generator that reuses the existing PATH_REWRITES mapping to produce the cross-domain redirect table from the old redirects.json (specific page redirects first, then wildcard prefix redirects + a /product catch-all). - Generate redirects-new-docs.json (509 redirects). - Wire it into next.config.mjs and point root / at the new introduction. basePath: false is intentionally omitted so sources still match under the /docs basePath while absolute destinations stay external (verified against Next.js load-custom-routes and checkCustomRoutes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Claude finished @keydunov's task in 2m 27s —— View job Claude Code ReviewVerdict: looks solid — 0 high, 2 medium, 3 low/nitsTasks
SummaryThe approach is clean: reuse
Medium
Low / nits
Notes / praise
|
The cross-domain redirect table (#11002) sent most legacy cube.dev/docs URLs to non-existent docs.cube.dev pages — 386 of 509 destinations (76%) returned 404, e.g. /product/data-modeling/reference/pre-aggregations went to the dead /docs/data-modeling/reference/pre-aggregations instead of the real /reference/data-modeling/pre-aggregations. Root cause: build_old_site_redirects.py reused rewrite_links.PATH_REWRITES, which describes an intermediate migration layout (/access-security, /api-reference, /analytics tabs and /docs/data-modeling/reference/...) that never shipped. Content was consolidated into the live tabs (admin, reference, docs, recipes, embedding, configuration, cube-core). Rewrite the generator to be content-driven and self-validating: - Derive each destination by matching the old page's body text against the live Mintlify pages (new files were copied from old ones during migration, so prose is preserved). 319 old pages mapped. - Pin ambiguous/consolidated/removed pages in an explicit OVERRIDES table, verified by hand against the real tree. - Emit a redirect for every legacy alias and every canonical /product page, plus a /product/:path* catch-all so nothing 404s. - Validate every destination against the on-disk Mintlify tree and exit non-zero if any would 404, so a broken table can't be committed silently. Regenerated redirects-new-docs.json (509 -> 774 entries, all validated). All 455 original alias sources remain covered. Live-checked the reported pre-aggregations page (now 200, was 404) plus a 30-destination sample (all 200). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
What
Sets up server-side 301 redirects from the old docs (
cube.dev/docs) to the new Mintlify docs (docs.cube.dev).The old Next.js/Nextra site stays deployed and issues cross-domain redirects so every legacy URL — and the many inbound links/SEO pointing at it — keeps resolving to the right page in the new docs.
Changes
docs-mintlify/scripts/build_old_site_redirects.py— generator that reuses the existingPATH_REWRITESmapping (single source of truth, shared withrewrite_links.py/migrate_redirects.py) to produce the cross-domain redirect table from the oldredirects.json. Re-runnable whenever the mapping orredirects.jsonchanges.docs/redirects-new-docs.json— generated table of 509 redirects, first-match-wins order:redirects.jsonentry, destination rewritten to the new structure) so consolidated/renamed pages reach their exact new home, e.g./product/administration/workspace/saved-reports→https://docs.cube.dev/admin/workspace./product/configuration/:path*→…/docs/configuration/:path*, etc.) plus a/product/:path*catch-all for pages that never needed an explicit redirect.docs/next.config.mjs— imports the new table and points root/athttps://docs.cube.dev/docs/introduction.Reviewer notes
basePath: falseis intentionally omitted. Verified against the installed Next.js 16.1.6 (load-custom-routes.js): a redirectsourcegets the/docsbasePath prefix unlessbasePath: falseis set, while absolutehttps://destinations are detected as external and never get basePath prepended. Omitting it makes sources match legacy/docs/...URLs while keeping cross-domain destinations intact. All 510 entries pass Next's owncheckCustomRoutesvalidator.cube.dev/blog/...are left untouched (not rewritten to docs.cube.dev) — intentional.cube.dev/docscontinuing to point at this old Vercel deployment so it can serve the redirects. Please confirm the old app stays live before/after the new docs cut over.🤖 Generated with Claude Code