Skip to content
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

Fix autogenerated sidebar issue #2688

Merged

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Dec 14, 2024

Description

As reported on Discord, this PR fixes an issue with autogenerated sidebar when using Starlight with Astro's new Content Layer API where nested group names would be sluggified.

I made a mistake two times when porting the treeify() and getBreadcrumbs() functions to Astro v5, the first time when I implemented it and the second time when Chris asked me clarifications about the changes. I convinced myself that these functions were dealing with slugs instead of paths (legacy ID), which is not the case and makes no sense in retrospect.

This PR reverts the changes I made to these functions and now, when using a loader, before sorting and treeifying the routes, it computes a localized file path relative to the collection's root. This mimics the behavior of the legacy ID. I also added a test with an autogenerated sidebar for a folder containing uppercase letters and spaces to make sure it works as expected as we didn't have one before.

Copy link

changeset-bot bot commented Dec 14, 2024

🦋 Changeset detected

Latest commit: 11f5af4

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

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Dec 14, 2024
Copy link

netlify bot commented Dec 14, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 11f5af4
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/675d78e23f648b00088e8713
😎 Deploy Preview https://deploy-preview-2688--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: 100 (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 site configuration.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix! Not sure I even realised we supported this, but glad it’s working for people and you could fix it so quickly 🙌

@delucis delucis added the 🌟 patch Change that triggers a patch release label Dec 14, 2024
@HiDeoo HiDeoo merged commit 5c6996c into withastro:main Dec 14, 2024
15 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Dec 14, 2024
@bomberstudios
Copy link

@HiDeoo the real MVP. Thanks a lot for the quick fix! 🧡

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