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
Docs should have breadcrumbs in addition to sidebar.
Has this been requested on Canny?
No
Motivation
I've just built this feature for someone: PatelN123/Digital-Support-Notes#1 (That person just wanted the primary category, but I did extract the entire breadcrumb list)
It wasn't quite ergonomic, and I think it would make sense to make itself into the core.
API design
It would be opt-in, something like showBreadcrumbs in the docs plugin. I think we can also set a metadata to help with SEO?
If we don't want an opinionated implementation for the UI component, we can just implement a useBreadCrumbs in theme-common and let users wrap DocItem to implement what they want.
Have you tried building it?
Yes, see that PR for how I did it.
Self-service
I'd be willing to contribute this feature to Docusaurus myself.
Yes, we could add that option, and probably turn it on by default if it looks good. I'm fine with an opinionated design as long as it can be turned off
SEO metas should probably always be there even if the option is turned off?
useBreadcrumb in theme-common 👍 the lighter the UI component the better
It is probably unnecessary to provide additional metadata here.
We now have a theme-common useDocsSidebar() (in docsUtils.ts), it should be possible to build on top of it a useDocsBreadcrumb(docId).
I'd like to use more context/hooks in the future instead of manipulation props, considering the doc metadata/sidebar should be available in React context wherever those hooks will be called (ie in Doc page components, including custom made components).
Activity
slorber commentedon Dec 15, 2021
Yes, we could add that option, and probably turn it on by default if it looks good. I'm fine with an opinionated design as long as it can be turned off
SEO metas should probably always be there even if the option is turned off?
useBreadcrumbin theme-common 👍 the lighter the UI component the betterThere's already a component in Infima:
https://infima.dev/docs/components/breadcrumbs
Seems only used on the search page 😅 : https://docusaurus.io/search?q=doc
christopherklint97 commentedon Dec 16, 2021
Is it ok if I start working on this? Or will the implementation just be @Josh-Cena
useBreadcrumbs?Josh-Cena commentedon Dec 16, 2021
@christopherklint97 You can start with
useBreadcrumbs+ a metadata in each Doc item, and then we can discuss if the UI feature is usefulslorber commentedon Dec 17, 2021
It is probably unnecessary to provide additional metadata here.
We now have a theme-common
useDocsSidebar()(indocsUtils.ts), it should be possible to build on top of it auseDocsBreadcrumb(docId).I'd like to use more context/hooks in the future instead of manipulation props, considering the doc metadata/sidebar should be available in React context wherever those hooks will be called (ie in Doc page components, including custom made components).
Josh-Cena commentedon Dec 17, 2021
When I say metadata I don't mean props. I mean hooks +
<head><meta />