starlight icon indicating copy to clipboard operation
starlight copied to clipboard

Feat: Autogenerate sidebar labels

Open lorenzolewis opened this issue 1 year ago β€’ 2 comments

Description

  • Resolves https://github.com/withastro/starlight/discussions/1630
  • Now using a sidebar entry with the key slug to specify the file will dynamically pull in that file's title

TODOs

  • [ ] Do the test updates look alright? I added on to the current tests instead of breaking out into a separate one, but can do that if wanted
  • [ ] Changeset
  • [ ] Docs updates

lorenzolewis avatar May 15 '24 21:05 lorenzolewis

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
starlight βœ… Ready (Inspect) Visit Preview Jul 5, 2024 10:55am

vercel[bot] avatar May 15 '24 21:05 vercel[bot]

πŸ¦‹ Changeset detected

Latest commit: 07c06963255ff9c678445976c8acb1c8d645e681

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

changeset-bot[bot] avatar May 15 '24 21:05 changeset-bot[bot]

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/sidebar.mdx Source changed, localizations will be marked as outdated.
en reference/configuration.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.

astrobot-houston avatar May 21 '24 13:05 astrobot-houston

Wow! Very nice feature, it will greatly improve the DX!

I also faced this and it feels uncomfortable especially when the sidebar contains autogenerated groups and some manually added items. In this case, the autogenerated pages define their sidebar title in the Front Matter section. At the same time, the manual items should define it in the sidebar configuration.

This is also bad for i18n, because the labels for manually added items should be localized separately using the translations configuration.

Waiting for this to ship! πŸš€

andrii-bodnar avatar Jul 03 '24 09:07 andrii-bodnar

Thanks for diving in, @delucis , and feel free to run wild with any of my PRs anytime πŸ˜‚

RE: usage in the sidebar guide, I think it's covered pretty well with what you've written. My only though overall for documentation is that it may be helpful to specify this is for files in src/content as "internal" could also be considered for thinks like assets, public files, and non-content collection pages.

lorenzolewis avatar Jul 04 '24 06:07 lorenzolewis

My only though overall for documentation is that it may be helpful to specify this is for files in src/content as "internal" could also be considered for thinks like assets, public files, and non-content collection pages.

Yes, I also considered that. That’s why I used β€œinternal docs pages”, but agree that being more explicit could make sense! Let me have a quick try.

delucis avatar Jul 04 '24 09:07 delucis

LGTM!

lorenzolewis avatar Jul 04 '24 11:07 lorenzolewis

I was just looking for this functionality this morning, perfect timing, and great work! Thank you πŸ™

kmalloy24 avatar Jul 08 '24 17:07 kmalloy24