-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
feat(content-docs): autogenerate category with linked doc metadata as fallback #6859
Conversation
return { | ||
id, | ||
position: doc.sidebarPosition, | ||
label: doc.frontMatter.sidebar_label ?? doc.title, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's too optimistic to fall back to doc.title
? Maybe some users keep their folder names readable and they intend to use the folder name instead of the linked doc's title? But if a user doesn't want to use _category_.json
, it is often convenient to make them not specify sidebar_label
either...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are options in case user is not happy, that looks good enough to me
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6859--docusaurus-2.netlify.app/ |
Size Change: 0 B Total Size: 805 kB ℹ️ View Unchanged
|
afbf718
to
5b392a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 thanks
Going to mark this as a slight breaking change, because behavior has changed |
Breaking change
The sidebar labels may have changed if you previously relied on a folder's name as category label. The index doc's title will be used instead. To restore the old behavior, simply add a
label
field in your_category_.json
.Motivation
Close #6254. Supercedes #6249
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Added a test case
In these pages: https://deploy-preview-6859--docusaurus-2.netlify.app/tests/docs/tests/category-links/custom-index-convention/intro/ the category labels are now the docs' titles instead of the folder names