feat(content-docs): autogenerate category with linked doc metadata as fallback#6859
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.
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.
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
|
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
labelfield 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