Skip to content

Fix a routing issue with unnormalized content collection slugs#3327

Merged
delucis merged 7 commits intomainfrom
chris/param-normalization
Jul 18, 2025
Merged

Fix a routing issue with unnormalized content collection slugs#3327
delucis merged 7 commits intomainfrom
chris/param-normalization

Conversation

@delucis
Copy link
Copy Markdown
Member

@delucis delucis commented Jul 18, 2025

Description

  • This PR fixes mapping between Astro.params and content collection entries for entries which have a filename with non-normalized composition.
  • For example, اللُّغَةُ-الْعَرَبِيَّةُ/الْآجُرُومِيَّةُ.md uses a mix of precomposed and decomposed diacritics. However, Astro’s router always normalizes URL parameters, which led to a mismatch between Starlight’s routes and Astro’s params, resulting in a 404 for a file with that name.
  • Starlight’s internal route map now normalizes slugs to match Astro’s behaviour.
  • One issue this can’t fix is differences between the composition of a user-authored link in Markdown and the actual built URL. For example, this change fixes the 404 issue but this means the output HTML file name is now differently composed than the input Markdown file name. If a user-authored link uses the same composition as the input file name, that will still be a 404, because it doesn’t match the output composition. Long story short, maybe people should avoid risking diacritics in URLs 😅 But at least we’re now matching Astro’s behaviour so there is a path to doing this without manually normalizing your file names.

N.B. The test changes in this PR look big because I wrapped existing tests in a describe() block, but apart from that those haven’t actually changed. I just renamed components.test.ts to basics.test.ts to match and reuse the basics fixture and avoid spinning up a new fixture just for this.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 18, 2025

🦋 Changeset detected

Latest commit: 1d5e1b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Jul 18, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 1d5e1b7
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/687a6a9bdfc97a0009d825e4
😎 Deploy Preview https://deploy-preview-3327--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@delucis delucis added the 🌟 patch Change that triggers a patch release label Jul 18, 2025
@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Jul 18, 2025
@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Jul 18, 2025

size-limit report 📦

Path Size
/index.html 7.21 KB (0%)
/_astro/*.js 25.76 KB (0%)
/_astro/*.css 14.25 KB (0%)

Copy link
Copy Markdown
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

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

Left a tiny suggestion to add a comment, up to you if you want to add it or not, but otherwise, looks great and makes sense (as much as it can considering the topic ^^) to me.

Great investigation and fix 👏

delucis and others added 2 commits July 18, 2025 17:29
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
@delucis delucis merged commit bf58c60 into main Jul 18, 2025
15 checks passed
@delucis delucis deleted the chris/param-normalization branch July 18, 2025 15:43
@astrobot-houston astrobot-houston mentioned this pull request Jul 18, 2025
gxxxr-111 pushed a commit to gxxxr-111/starlight that referenced this pull request Apr 9, 2026
…stro#3327)

Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants