Skip to content

fix: fix DM archive doc URL resolution#701

Merged
qiancai merged 4 commits into
masterfrom
fix-dm-archive-doc-urls
May 14, 2026
Merged

fix: fix DM archive doc URL resolution#701
qiancai merged 4 commits into
masterfrom
fix-dm-archive-doc-urls

Conversation

@qiancai
Copy link
Copy Markdown
Collaborator

@qiancai qiancai commented May 13, 2026

Summary

Fix the broken URLs of archived data migration docs, such as https://docs-archive.pingcap.com/tidb-data-migration/v5.3/, which were reported in pingcap/docs#22867.

  • Add a dedicated URL resolver rule for TiDB Data Migration release branches.
  • Map DM release-* branches to versioned archive paths such as /tidb-data-migration/v5.3/, /tidb-data-migration/v2.0/, and /tidb-data-migration/v1.0/.
  • Preserve folder paths for DM subfolder _index.md pages to avoid future URL collisions.
  • Resolve internal links in archived DM pages with the same versioned-doc link rules used by TiDB and TiDB Operator docs.
  • Show the archived DM version switcher so DM archive pages can switch among v5.3, v2.0, and v1.0 like TiDB Operator archive pages.
  • Add resolver tests for English and Chinese DM v5.3, v2.0, and v1.0 archive index paths, plus representative DM page and nested index paths.

Root cause

DM pages were falling through to the generic fallback rule, which drops the branch segment. As a result, release-5.3, release-2.0, and release-1.0 pages were generated under /tidb-data-migration/ or /zh/tidb-data-migration/ instead of their versioned archive paths.

The archive left navigation version selector was also namespace-gated for TiDB and TiDB Operator docs. DM has no active docs namespace on the main site and its regular versions list is empty, so archived DM pages did not show the version switcher even though docs.json already lists the archived DM versions.

Affected archive links

  • /tidb-data-migration/v5.3/
  • /tidb-data-migration/v2.0/
  • /tidb-data-migration/v1.0/
  • /zh/tidb-data-migration/v5.3/
  • /zh/tidb-data-migration/v2.0/
  • /zh/tidb-data-migration/v1.0/

Tests

  • NODE_PATH=/Users/grcai/Documents/GitHub/website-docs/node_modules /Users/grcai/Documents/GitHub/website-docs/node_modules/.bin/jest gatsby/url-resolver/__tests__/url-resolver.test.ts --runInBand
  • pnpm exec jest --roots gatsby --runInBand --coverage=false
  • Resolver smoke test using local /Users/grcai/Documents/GitHub/docs-staging/docs.json for all six affected DM archive index paths and a nested DM index path.
  • Preview site verification: archived DM pages now show the version switcher for v5.3, v2.0, and v1.0.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website-docs Error Error May 14, 2026 1:58am

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces specific URL resolution rules and branch alias mappings for the tidb-data-migration repository, ensuring that release branches (e.g., release-2.0) are correctly transformed into versioned URLs (e.g., v2.0). It also includes comprehensive test cases to verify these transformations across different languages and folder structures, including the handling of index files and language prefixes. A review comment suggests adding example mappings to the configuration comments to improve maintainability and consistency with existing patterns in the codebase.

Comment thread gatsby/url-resolver/config.ts
Copy link
Copy Markdown
Member

@shhdgit shhdgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@qiancai qiancai self-assigned this May 14, 2026
@qiancai qiancai merged commit 4c784f6 into master May 14, 2026
3 of 4 checks passed
@qiancai qiancai deleted the fix-dm-archive-doc-urls branch May 14, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants