feat: redirect latest v# to /latest and canonicalize old-version docs - #1143
Conversation
- 308 redirect the latest numbered version (e.g. /query/v5) to /latest, since both serve identical content from the same branch - old-version docs pages emit a rel=canonical to their /latest equivalent when the same doc path exists on the latest branch, checked via the cached docs path manifest (fails open) - version dropdown collapses "Latest" and the latest numbered version into a single "v# (latest)" option Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
tanstack-com | 4dfb207 | Commit Preview URL Branch Preview URL |
Aug 13 2026, 04:17 PM |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR standardizes latest-version routing around ChangesLatest version canonicalization
Estimated code review effort: 3 (Moderate) | ~25 minutes Mergeability Score: ⚪ Minimal · up to This change centralizes documentation redirects and canonical URLs to reduce duplicate search indexing while keeping older documentation readable; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant Visitor
participant VersionRoute
participant DocsRoute
participant loadDocsRoute
participant LatestBranchManifest
Visitor->>VersionRoute: request numbered latest URL
VersionRoute-->>Visitor: permanent 308 redirect to /latest
Visitor->>DocsRoute: request versioned document
DocsRoute->>loadDocsRoute: load document with latest branch
loadDocsRoute->>LatestBranchManifest: check equivalent docs path
LatestBranchManifest-->>loadDocsRoute: matching latestDocsPath or null
loadDocsRoute-->>DocsRoute: document and latestDocsPath
DocsRoute-->>Visitor: canonical, Open Graph, and Twitter URLs
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The root route's head() only receives pre-loader match snapshots (router-core's executeHead passes the matches array captured before loaders run), so it can never see a child loader's canonicalPathOverride. Emit the canonical link (and og:url/twitter:url) from the docs routes' own head() instead, where loaderData is fresh, and flag those routes with staticData.ownsCanonicalLink so the root suppresses its canonical and we never render two link tags. Also switch the version dropdown label to "v# - Latest". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Addresses old-version docs (e.g. Table v8, Query v3/v4) outranking latest docs in search results.
/query/v5/..., per each library'slatestVersion) to/latest/...— both serve identical content from the same branch, so only one URL should be indexed<link rel="canonical">(and matchingog:url/twitter:url) pointing to their/latestequivalent when the same doc path exists on the latest branchhead()(routehead()only sees freshloaderDatafor its own match, never for children), and those routes setstaticData.ownsCanonicalLinkso the root suppresses its default self-canonical — the router doesn't dedupe links, so exactly one tag renders🤖 Generated with Claude Code