-
Notifications
You must be signed in to change notification settings - Fork 381
Serve the v1.0.x release docs at the /docs root #5247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ | |
| "dependencies": { | ||
| "@docsearch/docusaurus-adapter": "catalog:", | ||
| "@docusaurus/core": "3.9.2", | ||
| "@docusaurus/plugin-client-redirects": "3.9.2", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 47799 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- changed files ---'
git status --short
printf '%s\n' '--- package dependency context ---'
sed -n '35,60p' docs/package.json
printf '%s\n' '--- redirect plugin references ---'
rg -n -C 3 '`@docusaurus/plugin-client-redirects`|redirects' docs/docusaurus.config.ts docs/package.json docs/src docs/content docs/versioned_docs 2>/dev/null || true
printf '%s\n' '--- relevant diff ---'
git diff -- docs/package.json docs/docusaurus.config.ts
printf '%s\n' '--- approval references ---'
rg -n -i -C 2 'approve|approval|dependency|plugin-client-redirects' .github docs README.md CONTRIBUTING.md 2>/dev/null || trueRepository: thunder-id/thunderid Length of output: 50379 Record approval for the added dependency.
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| "@docusaurus/plugin-content-blog": "3.9.2", | ||
| "@docusaurus/plugin-content-docs": "3.9.2", | ||
| "@docusaurus/preset-classic": "3.9.2", | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🤖 get_repo_knowledge executed:
get_repo_knowledge thunder-id/thunderid /tmp/coderabbit-repo-knowledge/thunder-id-thunderid-d1ee9b37/learnings /tmp/coderabbit-repo-knowledge/thunder-id-thunderid-d1ee9b37/conventionsLength of output: 44322
🏁 Script executed:
Repository: thunder-id/thunderid
Length of output: 36314
🏁 Script executed:
Repository: thunder-id/thunderid
Length of output: 9560
🏁 Script executed:
Repository: thunder-id/thunderid
Length of output: 10486
🌐 Web query:
site:docusaurus.io/docs/api/plugins/@docusaurus/plugin-client-redirects createRedirects existingPath💡 Result:
The createRedirects function is an option available in the
@docusaurus/plugin-client-redirectsplugin for Docusaurus [1][2]. It allows you to dynamically generate redirect rules for your site [1][3]. Functionality and Behavior: - Purpose: Docusaurus queries this callback function against every path it has already generated (the "to" path) [1][3]. - Parameter (existingPath): The function receives the path of an existing, generated page (the "to" route) as a string [1][3]. - Return Value: You return an array of strings (or a single string, null, or undefined) representing the paths that should redirect TO the current existingPath (the "from" routes) [1][3]. - Falsy Values: Returning null, undefined, or an empty array from the function results in no redirects being created for that specific path [1][3]. Important Considerations: - Logic Direction: The function logic should calculate the "from" path based on the "to" path [4]. A common mistake is attempting to derive the "to" path from the "from" path; remember that the plugin is iterating over pages that already exist [4][5]. - Production Only: This plugin generates static HTML files to handle redirects [6]. Consequently, these redirects are generally active only in production builds and may not function as expected in local development environments unless you perform a production-mode build locally [4][7]. - Duplicate Redirects: The plugin will ignore redirects that attempt to overwrite an existing page path to prevent conflicts [8]. Example Usage: In your docusaurus.config.js file: plugins: [ [ '@docusaurus/plugin-client-redirects', { createRedirects(existingPath) { // Example: Redirect from /docs/old/X to /docs/new/X if (existingPath.includes('/docs/new/')) { return [ existingPath.replace('/docs/new/', '/docs/old/'), ]; } return undefined; // No redirect for this path }, }, ], ], This differs from Gatsby's createRedirect action, which is used during page creation in gatsby-node.js to define redirects [9][10], whereas Docusaurus's createRedirects is a configuration-based callback for the client-redirects plugin [1][3].Citations:
Add regression coverage for the documentation route contract.
Use the actual Docusaurus configuration to test a root
/docs/...route that generates a redirect from/docs/v1.0.x/...to the root route. Also test that/docs/next/...returns no redirect. Do not add mock-only fallback tests. Preserve/docs/for v1.0.x,/docs/next/for Next, and legacy redirects.🤖 Prompt for AI Agents
Sources: Coding guidelines, Path instructions