fix: Internal links that emit double-slash URLs - #454
Conversation
👷 Deploy request for storybook-frontpage pending review.Visit the deploys page to approve it
|
👷 Deploy request for storybook-addon-catalog pending review.Visit the deploys page to approve it
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThe change normalizes duplicate slashes in documentation links, generated slugs, and external sitemap URLs. It adds root-relative link tests and centralizes sitemap URL formatting. ChangesURL normalization
Possibly related issues
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/frontpage/components/docs/mdx/a.tsxParsing error: File ' apps/frontpage/lib/fetch-external-sitemap.tsParsing error: File ' apps/frontpage/lib/get-all-trees.tsParsing error: File ' 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/frontpage/components/docs/mdx/a.tsx`:
- Around line 28-29: Update the href normalization in the anchor component
around the startsWith('/') branch so only the pathname is collapsed; preserve
query-string and fragment contents unchanged, including repeated slashes in
values such as search parameters or hash sections.
In `@apps/frontpage/lib/fetch-external-sitemap.ts`:
- Around line 10-12: Update the isTrailingSlashSite path check so each special
path matches only exactly or when followed by a `/`, rather than using an
unbounded startsWith match. Preserve classification for `/showcase`, `/blog`,
`/tutorials` and their descendants while excluding similarly prefixed paths such
as `/blogger` and `/showcase-old`.
In `@apps/frontpage/lib/get-all-trees.ts`:
- Around line 31-33: Filter empty segments immediately after splitting the path,
before version-routing logic reads splitSegment[0] and splitSegment[1]. Update
the path-processing flow in get-all-trees so inputs such as
content/docs//10.2/page.mdx correctly identify and remove the latest-version
segment, while preserving the existing final path construction.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ac83f11d-4241-4f84-a5e6-aa020265ca9a
📒 Files selected for processing (4)
apps/frontpage/components/docs/mdx/a.test.tsapps/frontpage/components/docs/mdx/a.tsxapps/frontpage/lib/fetch-external-sitemap.tsapps/frontpage/lib/get-all-trees.ts
This PR fixes a bug where internal documentation links could resolve to URLs containing duplicate slashes, such as
//blog/...or//docs/....These malformed URLs could break navigation and produce inconsistent links when rendering MDX content.What changed
Issue: #450
When a link started with
/or included repeated separators, the resulting URL could contain a double slash and produce invalid or unexpected routes.