Skip to content

Use Starlight sidebar user-config format for <StarlightPage /> sidebar prop#2168

Merged
delucis merged 5 commits intowithastro:mainfrom
HiDeoo:hd-refactor-starlight-page-sidebar
Aug 16, 2024
Merged

Use Starlight sidebar user-config format for <StarlightPage /> sidebar prop#2168
delucis merged 5 commits intowithastro:mainfrom
HiDeoo:hd-refactor-starlight-page-sidebar

Conversation

@HiDeoo
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo commented Aug 6, 2024

Description

This PR changes the data accepted by the sidebar prop of the <StarlightPage /> component used by custom routes.

With this change, the sidebar prop can now accept a sidebar configuration identical to the one used by the sidebar Starlight configuration.

A few demo custom pages have been temporarily added to the docs to play around with the changes.

Remaining task

  • Remove the demo link in docs/astro.config.mjs
  • Remove docs/src/pages/test-1.astro
  • Remove docs/src/pages/test-2.astro
  • Remove docs/src/pages/test-[index].astro
  • Add a changeset (need to think about it, not sure we can provide an easy "migration" guide as the format can be quite different and involves a few different types of links if we wanted to cover everything — maybe a link to the sidebar guide?)

Idea

Could be worth maybe adding a new example to https://starlight-examples.netlify.app/ showing how to re-use a sidebar configuration between the Starlight configuration and a custom page where the custom page appends a few more items to the sidebar.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Aug 6, 2024

🦋 Changeset detected

Latest commit: b569fd2

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 Minor

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 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Aug 6, 2024
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 6, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit b569fd2
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/66bf767c8f661100087f5231
😎 Deploy Preview https://deploy-preview-2168--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: 92 (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.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Aug 6, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/pages.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Copy Markdown
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.

Oh boy, the code is so much simpler, not sure why we didn’t think to do it to begin with 😁

Looks good to me — I think you can remove the test files. Also needs a changeset explaining how to migrate if you’re using <StarlightPage>.

@delucis delucis added the 🌟 minor Change that triggers a minor release label Aug 16, 2024
@HiDeoo
Copy link
Copy Markdown
Member Author

HiDeoo commented Aug 16, 2024

Oh boy, the code is so much simpler, not sure why we didn’t think to do it to begin with 😁

Yeah, I had the exact same thought when working on the changes, not sure why either 😅

I've removed the test pages and added a changeset (altho, not super happy with it, tried to use a diff code block but I thought it was not super easy to read, so I went with 2 code blocks instead, but this ends up being a massive changeset).

Copy link
Copy Markdown
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.

I think the examples are good here! Yes, it’s big, but I agree this is clear (I also quickly tried a diff but it feels more confusing than helpful).

@delucis delucis merged commit e044fee into withastro:main Aug 16, 2024
@astrobot-houston astrobot-houston mentioned this pull request Aug 16, 2024
Yoxnear pushed a commit to Yoxnear/starlight-custom that referenced this pull request Jul 23, 2025
…idebar` prop (withastro#2168)

Co-authored-by: Chris Swithinbank <swithinbank@gmail.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 📚 docs Documentation website changes 🌟 minor Change that triggers a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants