-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Ability to link navbar to a given sidebar #6117
Comments
I'd like to give this issue a try! |
This may be more complicated than I thought. The theme layout does not have access to all docs-related data (on purpose), but it can only read docs global data (like other docs-related navbar items). I don't think there's enough data in this global data structure to be able to find out what the link should be. Also, if a sidebar starts with a category, and that category has a Cf the podcast site above. If the "Episodes" category was a The new global data structure should probably look like this: type GlobalSidebarLink = { label: string; path: string };
type GlobalSidebar = {
link?: GlobalSidebarLink;
// ... we may add other things here later
};
// already existing type
export type GlobalVersion = {
// ...
sidebars: Record<string, GlobalSidebar>;
}; Also, can we infer the navbar label from the link label so that the navbar label is optional? 🤷♂️ not sure if it's very useful but maybe in some cases? |
@slorber ah so I assume after that we need to add a Is this the approach you have in mind? |
@lmpham1 Sounds about right. You can mimic how the |
Yes 👍
For future proofness, I'd rather have an object with a link attribute, also the label type GlobalSidebarLink = { label: string; path: string };
type GlobalSidebar = {
link?: GlobalSidebarLink;
// ... we may add other things here later
}; |
Have you read the Contributing Guidelines on issues?
Motivation
Sometimes we just want to link to the first doc of a given sidebar, without having to specify a given doc ID.
This can be useful to implement tabs navigation, like on our site, RN, Jest...
This could become more natural with:
Another use-case mentioned is to use the docs plugin for a podcast: https://thediffpodcast.com/docs/episode-10
This is not convenient because on each new episode it requires editing the config navbar items to link to that latest episode.
This shouldn't be too hard to implement so if any external contributor is interested, please let me know ;)
Self-service
The text was updated successfully, but these errors were encountered: