Conversation
endiliey
left a comment
There was a problem hiding this comment.
Tests are failing. Had some suggestions after skimming through
v1/website/sidebars.json
Outdated
| "translation", | ||
| "versioning" | ||
| ], | ||
| "Hello": { |
There was a problem hiding this comment.
Its not in the suggested format ? It should be in array
There was a problem hiding this comment.
I thought I removed this but I didn't
v1/lib/server/readMetadata.js
Outdated
| id: subcategoryItem, | ||
| category, | ||
| subcategory, | ||
| sort: sidebarItems.length + 1, |
There was a problem hiding this comment.
This is more of a question.
Do you think we need the sort. To be honest im not sure.
There was a problem hiding this comment.
Hmm true. I'll remove this and see if it still works. This sort is added sequentially and it doesn't seem to do anything.
There was a problem hiding this comment.
We still need it because we make them into an object into readCategories, this sort field ensures that the order is not lost (not depending on the order of the keys, which is a good thing).
|
Deploy preview for docusaurus-preview ready! Built with commit b6495d0 |
|
@endiliey I basically rewrote the whole subcategory implementation because I just realized it only allows adding subcategories at the bottom of a category. I had to change the Blog metadata format also because it was using the same If you get the chance please patch and test it! 😄 |
There was a problem hiding this comment.
I think in the future we might want to allow href linking on sidebars as well. #827
What do you think of changing the proposed format.
Sidebar item - subcategory
{
type: 'subcategory',
label: 'My Subcategory',
ids: []
}
Sidebar item - url/href
{
type: 'url'
label: 'GitHub',
href: 'github.com'
}
Sidebar item - doc id (default)
doc3
Eventually we have
'Second Category': [
'doc3',
{
type: 'url',
label: 'Github',
href: 'github.com'
},
{
'type': 'subcategory',
'label': 'my subcategory',
'ids': ['doc4'],
},
'doc5',
],
This makes it scalable 😁. Imo
endiliey
left a comment
There was a problem hiding this comment.
Consider dogfooding one of our sidebars ?
|
Thank you @yangshun! I'm testing it and it's just what we need. |
|
Yes, we'd have to add that feature in. Even if we add it in, the UX will not be ideal because the page does a full refresh and the expanded/collapsed state will be lost upon transition to new pages. Hence, I'm not that inclined on adding it. Any better ideas? |
|
I wouldn't mind too much of getting it collapsed every time the page is opened. Remembering the state would be nice to have, but not a must IMO. |
Motivation
The previous subcategory format had issues where the subcategory had to be an object. This means that all subcategories' siblings all have to be subcategories. In reality it should be possible to mix non-subcategories into the same layer.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Unit tests.
Example of subcategories in action:
Related PRs
#892