Repository navigation
fix(docs): prefer category indexes over document references (AI-assisted) - #13103
spdeepak97 wants to merge 1 commit into
Conversation
|
Hi @spdeepak97! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Motivation
When Tutorial Basics contains a document entry pointing to the Tutorial Extras overview,
<DocCardList />on that overview can render Tutorial Basics cards. The breadcrumb search stops at the earlier document reference before reaching the category whose index URL matches the current page.Search the entire sidebar for matching category indexes first, then fall back to the existing document lookup. This preserves the full parent trail for nested categories. If several categories share an index URL, the first match in depth-first sidebar order wins. Ordinary document pages retain the existing lookup and root-level fallback.
Related to #10475. The plain-link case is already handled by current main; this fixes the remaining document-entry variation.
Changes
getSidebarBreadcrumbs.DocCardListtests with Tutorial Basics referencing the Tutorial Extras overview through a plain link, a document link, and duplicate document links. Assert the exact Extras card titles and destinations.@themealias to the absolute theme source path so the component test can load the real card components.Test plan
Validated against main at
809ffffd5c8436e7458b9a2c494ce3fe7f8ef0bc, with Node 26.13.0 and pnpm 12.3.4.docsUtils.tsx: 4 failed, 47 passed. The failures include the two rendered-card document-reference cases and nested category lookup/breadcrumb checks.git diff --checkpassed.Commands:
pnpm vitest run packages/docusaurus-plugin-content-docs/src/client/__tests__/docsUtils.test.tsx packages/docusaurus-plugin-content-docs/src/__tests__/docCardList.test.tsx GIT_DISCOVERY_ACROSS_FILESYSTEM=1 pnpm test pnpm typecheck:testsThe Git discovery environment setting is needed for the existing untracked-directory Git error snapshot in this container: without it, Git adds a filesystem-boundary message and that unrelated snapshot fails. No snapshot or Git utility code was changed.
Checklist
This contribution was prepared with AI assistance for implementation and test execution.
Summary by CodeRabbit