-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: redirect for patch routes #247
Conversation
WalkthroughThis update refines the Docusaurus configuration and introduces a new redirection feature. The Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant B as Browser
participant R as RedirectScript
U->>B: Request "/unraid-os/release-notes/X.Y.Z+patch.N"
B->>B: Load page (includes docusaurus.config.js)
B->>R: Execute redirects.js
R->>R: Match URL against regex pattern
alt Pattern matches
R->>B: Set window.location.href to "/unraid-os/release-notes/{baseVersion}#patches"
else No match
R->>B: No redirection, normal flow continues
end
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (4)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
static/js/redirects.js (1)
1-18
: Clean implementation of the redirect mechanism.The script effectively handles redirections for patch releases by capturing the base version from URLs matching the pattern
/unraid-os/release-notes/X.Y.Z+patch.N
and redirecting to the patches section of the corresponding main version page.However, consider adding some basic error handling in case anything unexpected happens during redirection:
if (match) { // Get the base version (X.Y.Z) const baseVersion = match[1]; // Redirect to the patches section of that version + try { window.location.href = `/unraid-os/release-notes/${baseVersion}#patches`; + } catch (e) { + console.error('Failed to redirect:', e); + } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (3)
docusaurus.config.js
(5 hunks)package.json
(1 hunks)static/js/redirects.js
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build
- GitHub Check: AWS Amplify Console Web Preview
🔇 Additional comments (3)
package.json (1)
21-21
: Good alignment of dependency versions.Updating the
@docusaurus/plugin-client-redirects
to version ^3.7.0 brings it in line with other Docusaurus dependencies like@docusaurus/core
and@docusaurus/preset-classic
, ensuring better consistency and compatibility.docusaurus.config.js (2)
37-42
: Well-organized integration of client-side redirect script.The configuration properly includes the new redirects.js script with
async: false
to ensure it loads and executes before page rendering, which is appropriate for redirection logic that needs to run immediately.
89-89
: Good consistency improvements in formatting.The switch to double quotes for string literals and the reformatting of the keywords metadata improves code consistency and readability without changing functionality.
Also applies to: 111-115, 213-213, 216-220
9472f5b
to
f3a37ff
Compare
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Before Submitting This PR, Please Ensure You Have Completed The Following:
Summary by CodeRabbit
New Features
Chores