You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sidebar categories linking to a doc or category index page #2643
Category in docs are only container for subitems (topics). But some help system enable category to be introductory topic to subitems (ie containing text that introduce the subitems or refers to subitems ie see also links to subtopic1, sub..)
changed the title [-]Enable docs "category" to be introductory topic for subtopics[/-][+]Allow docs "category" to be introductory topic for subtopics[/+]on Apr 25, 2020
+1 to this feature request. I have a case right now where I'm migrating docs over to docusaurus and we've set all nav items to be expanded by default.
themeConfig: {
sidebarCollapsible: false,
}
Currently if you try clicking on the category item in the nav, nothing happens and it would be helpful to be able to add an optional link to a doc page on the category:
Example where introDoc.md is the doc when you click on the nav item.
Some users want this behavior but some other users prefer that the category are just labels and not clickable. If we were to add support for this, we might need to change how the pure categories look, such that they don't look clickable.
Hey, didn't notice this issue, that also seems related to a more recent one: #3051
@sladyn98 there's ongoing work to be merged on the docs plugin + a few other important refactors I'd like to do.
This won't be time lost to have such a POC of this feature, and would help collect feedback, but just be aware that you might not be able to rebase it easily, and might need to re-open a brand new pull request 🤪
Would render an automatically generated table of content of all the inner-tree of this category (we could later see how to make this view more useful by adding additional data to it, maybe a small doc summary or something)
Reacted by Aaron Crawfis, Liu, Magnus, Eliseo Papa and suin
changed the title [-]Allow docs "category" to be introductory topic for subtopics[/-][+]Sidebar categories linking to a doc or category index page[/+]on Nov 5, 2020
Is there any update on this feature?
Is there any proposed solution for now?
Currently I have a duplicate entry in my sidebar representing the category file. This of course looks a little bit ugly.
This is quite often requested (#3686) so we'll try to find a solution, but it will come after i18n support.
In the meantime, if someone wants to design the API surface and write an exhaustive RFC, so that it is flexible and suit all the use-cases reported, that would help.
The design of this feature is not so straightforward as we are not sure yet how it should behave regarding category collapsing.
Just wanted to add that this is how the kubernetes.io docs work which to me are great. Would love to have this be available (if not default) behavior in docusaurus!
I would definitely like to see this as well. I have encountered the requested functionality several times just today on different sites. In addition to the kubernetes.io docs mentioned by @chrisdostert:
I like the sidebar behavior of the GitHub docs best (although the k8s docs operate similarly). It hides the sub-articles of the other categories that are not related to doc currently in view. I do not find this behavior confusing or annoying. It makes the sidebar easier to grok.
Thanks for showing some examples. We'll try to find an API that allows all these slightly different UX so that you can choose the one you want.
I like the sidebar behavior of the GitHub docs best (although the k8s docs operate similarly). It hides the sub-articles of the other categories that are not related to doc currently in view. I do not find this behavior confusing or annoying. It makes the sidebar easier to grok.
At the same time it's confusing if the item you click on immediately change position. I guess it's an acceptable tradeoff, but we should probably not enforce this specific UX.
If possible, it would be nice if you could also fetch the card data only somehow, where I could have an index page, but then still render cards on it as well.
I don't understand what this means sorry 😅
Perhaps we could add a little bit more spacing between the Title and the Icon of a card?
Would there be a possibility to add a customization option to assign those icons/svgs for the card icons?
We'll likely improve the design and add customization options later. Here I'm mostly focusing on the initial MVP with the UX and a good extensible public API that we can improve later.
Note that these theme components are well encapsulated and easy to customize with a swizzle.
Thanks for your feedback, which is mostly about design and "shortcut" options, we can improve all that incrementally from the current state later in subsequent PRs, and in the meantime using swizzle is likely a good enough workaround until we figure out the most wanted customization apis.
If possible, it would be nice if you could also fetch the card data only somehow, where I could have an index page, but then still render cards on it as well.
@slorber By that he means, you have a normal doc page as index page, but inject the category items in it as JSON so it can be rendered somewhere in the middle of the page, kind of like the TOCInline where we have a global toc export to do this.
It's already technically possible atm using hooks in the MDX doc, but probably not with the most intuitive API. We can figure out later how to add MDX shortcodes for that.
I’ve been following the progress of this for a while now, and I love how this is forming. Really great work!
Request:
Can you close the Table of Contents panel when tapping the Category item (that has a page) on the mobile version? Currently, that panel stays open which makes it seem like nothing has occurred.
Reacted by Sébastien Lorber and Paraskevas K. Leivadaros
Is it easy to change/remove the icons, or would I have to swizzle the component for that?
@slorber Is it possible to popularize the idea of CSS ::before pseudoelements for these icons?
For now you can swizzle the DocCard component
We don't have yet a good way to manage theme icons, we'll try to normalize how we handle icons in themes as part of #5865 and make sure that overriding an icon is consistent for all the existing use-cases of the theme.
If you have a better icon/design we can also improve our current design. Feel free to override DocCard in userland for now, show us the result, and eventually if the design is better we can make it the default later.
Can you close the Table of Contents panel when tapping the Category item (that has a page) on the mobile version? Currently, that panel stays open which makes it seem like nothing has occurred.
Hey guys 😄
I've been struggling to find the option to enable this?
I didn't want to bother reading through all these comments, therefore I am asking :)
I also couldn't find anything related to it in your docs
Interestingly, Gatsby actually moved away from this style. My guess would be that it's because readers might miss that they can click on the category sidebar to read info. Readers might sometimes expand the category using the arrow instead, thereby missing crucial introductory info. This can also happen if the reader opens a category subpage from an external link, in which case it's unlikely they'll know to click the category in the sidebar since it's already expanded.
I'd argue that one can achieve the best of both worlds by making any clicks to the category redirect the reader to the intro subpage. That way, it's still a quick experience (same # of clicks), but makes the intro information explicit. I've created #8833 to add support for this :)
Activity
[-]Enable docs "category" to be introductory topic for subtopics[/-][+]Allow docs "category" to be introductory topic for subtopics[/+]hsiaoer commentedon May 22, 2020
+1 to this feature request. I have a case right now where I'm migrating docs over to docusaurus and we've set all nav items to be expanded by default.
Currently if you try clicking on the category item in the nav, nothing happens and it would be helpful to be able to add an optional link to a doc page on the category:
Example where introDoc.md is the doc when you click on the nav item.
yangshun commentedon Jun 5, 2020
Some users want this behavior but some other users prefer that the category are just labels and not clickable. If we were to add support for this, we might need to change how the pure categories look, such that they don't look clickable.
sladyn98 commentedon Jul 15, 2020
@yangshun Is this still a starter issue to be worked on if yes I could maybe give it a shot.
slorber commentedon Jul 20, 2020
Hey, didn't notice this issue, that also seems related to a more recent one: #3051
@sladyn98 there's ongoing work to be merged on the docs plugin + a few other important refactors I'd like to do.
This won't be time lost to have such a POC of this feature, and would help collect feedback, but just be aware that you might not be able to rebase it easily, and might need to re-open a brand new pull request 🤪
slorber commentedon Jul 20, 2020
Raw thoughts but here's a possible api:
Would render the introDocId doc.
Would render an automatically generated table of content of all the inner-tree of this category (we could later see how to make this view more useful by adding additional data to it, maybe a small doc summary or something)
[-]Allow docs "category" to be introductory topic for subtopics[/-][+]Sidebar categories linking to a doc or category index page[/+]TomPeirs commentedon Nov 10, 2020
Is there any update on this feature?
Is there any proposed solution for now?
Currently I have a duplicate entry in my sidebar representing the category file. This of course looks a little bit ugly.
slorber commentedon Nov 10, 2020
This is quite often requested (#3686) so we'll try to find a solution, but it will come after i18n support.
In the meantime, if someone wants to design the API surface and write an exhaustive RFC, so that it is flexible and suit all the use-cases reported, that would help.
The design of this feature is not so straightforward as we are not sure yet how it should behave regarding category collapsing.
chrisdostert commentedon Nov 10, 2020
Just wanted to add that this is how the kubernetes.io docs work which to me are great. Would love to have this be available (if not default) behavior in docusaurus!
ctlajoie commentedon Nov 21, 2020
I would definitely like to see this as well. I have encountered the requested functionality several times just today on different sites. In addition to the kubernetes.io docs mentioned by @chrisdostert:
I like the sidebar behavior of the GitHub docs best (although the k8s docs operate similarly). It hides the sub-articles of the other categories that are not related to doc currently in view. I do not find this behavior confusing or annoying. It makes the sidebar easier to grok.
slorber commentedon Nov 23, 2020
Thanks for showing some examples. We'll try to find an API that allows all these slightly different UX so that you can choose the one you want.
At the same time it's confusing if the item you click on immediately change position. I guess it's an acceptable tradeoff, but we should probably not enforce this specific UX.
42 remaining items
slorber commentedon Nov 26, 2021
Yes, we'll allow collapsing a category
External links have a different icon, this can be seen here: https://deploy-preview-5830--docusaurus-2.netlify.app/tests/docs/category/tests/
I don't understand what this means sorry 😅
We'll likely improve the design and add customization options later. Here I'm mostly focusing on the initial MVP with the UX and a good extensible public API that we can improve later.
Note that these theme components are well encapsulated and easy to customize with a swizzle.
Thanks for your feedback, which is mostly about design and "shortcut" options, we can improve all that incrementally from the current state later in subsequent PRs, and in the meantime using swizzle is likely a good enough workaround until we figure out the most wanted customization apis.
Josh-Cena commentedon Nov 26, 2021
@slorber By that he means, you have a normal doc page as index page, but inject the category items in it as JSON so it can be rendered somewhere in the middle of the page, kind of like the
TOCInlinewhere we have a globaltocexport to do this.My idea would be to inject this in
MDXProviderslorber commentedon Nov 26, 2021
Oh I see, something like this?
It's already technically possible atm using hooks in the MDX doc, but probably not with the most intuitive API. We can figure out later how to add MDX shortcodes for that.
slorber commentedon Dec 2, 2021
PR and UX ready for a final review!
Unless there's any pushback, this is going to be merged tomorrow!
#5830
Test URLs:
Docs:
index.mdconventionPlease share your last feedback asap
dsmmcken commentedon Dec 2, 2021
Is it easy to change/remove the icons, or would I have to swizzle the component for that?
Josh-Cena commentedon Dec 2, 2021
@slorber Is it possible to popularize the idea of CSS
::beforepseudoelements for these icons?seanbrakefield commentedon Dec 2, 2021
I’ve been following the progress of this for a while now, and I love how this is forming. Really great work!
Request:
Can you close the Table of Contents panel when tapping the Category item (that has a page) on the mobile version? Currently, that panel stays open which makes it seem like nothing has occurred.
slorber commentedon Dec 3, 2021
For now you can swizzle the
DocCardcomponentWe don't have yet a good way to manage theme icons, we'll try to normalize how we handle icons in themes as part of #5865 and make sure that overriding an icon is consistent for all the existing use-cases of the theme.
If you have a better icon/design we can also improve our current design. Feel free to override
DocCardin userland for now, show us the result, and eventually if the design is better we can make it the default later.Yes, also noticed that ;) this has been fixed
slorber commentedon Dec 3, 2021
This has been published in canary (0.0.0-4241) and scheduled for a release next week
Please give it a try and tell us if it works fine ;)
Update docusaurus to 2.0.0-beta.15
sivert-io commentedon Jul 11, 2022
Hey guys 😄
I've been struggling to find the option to enable this?
I didn't want to bother reading through all these comments, therefore I am asking :)
I also couldn't find anything related to it in your docs
Josh-Cena commentedon Jul 11, 2022
@SivertGullbergHansen
bfelbo commentedon Mar 27, 2023
Interestingly, Gatsby actually moved away from this style. My guess would be that it's because readers might miss that they can click on the category sidebar to read info. Readers might sometimes expand the category using the arrow instead, thereby missing crucial introductory info. This can also happen if the reader opens a category subpage from an external link, in which case it's unlikely they'll know to click the category in the sidebar since it's already expanded.
I'd argue that one can achieve the best of both worlds by making any clicks to the category redirect the reader to the intro subpage. That way, it's still a quick experience (same # of clicks), but makes the intro information explicit. I've created #8833 to add support for this :)