-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Allow using one doc id in multiple sidebars #868
Comments
In case when this issue will be accepted, I can add support for custom links from #827 |
Are you planning to work on all of this or just the custom links support from #827 ? |
I would like to work on all of this. I think, that two issues can be solved in one pull request, because it is, actually the same part of the code. But we need to decide with config structure first. |
I think this is a great addition. I have one question though, why do we need a
|
that three dots was just three dots to indicate some "other" config entries. I've wrapped it in quotes so that it will be syntactically correct :) |
My bad, kinda missed that. Maybe next time it should be written as Anyway, I agree with the dot notation (e.g: docs.adding-blog). The idea of namespacing is great. I think you can proceed as I think this won't break anything and will be an added feature. |
ok. What will we use for custom links from #827? [
"href:/foo/bar", // or `link`, or `url`?
] or [
{ // the same format as in siteConfig.js
"href": "https://github.com",
"label": "Github"
}
] The first one is shorter. The last one is the most flexible. We can also support I think, that there will be very few cases, when the user will need to link to some external resources from sidebar, so we can stick with the last example, because it is the most generic. In future it will possible to add shortcut syntax too. |
Lets go with the last one. Shouldn't be too hard to change it if needed. 👍 |
@endiliey can I split the code from |
@SleepWalker sure, you can refactor it to many files or maybe smaller functions instead of many files as long as it doesnt change functionality. Tests are great. If there isnt too much refactor, a separate PR might not be needed. |
@endiliey, @ericnakagawa I have a question about next/prev links at the page bottom in case, when we are using Object with href and label to define the sidebar link. In this case the link may point outside current site. Should the next/prev navigation include this link or should we skip the link and point to the document next (or previous) to the link? |
@SleepWalker Hi 👋 Can you provide an example where you may have an external link from an internal doc page? That said, if that was to happen, I believe either:
I think we should, at the very least, avoid closing the current site all together. |
@JoelMarcey That's a request from #827. It can be that the link will point to the same domain, but that may be a page outside of Docusaurus context (e.g. auto-generated API docs with their own layout and navigation). So which of the two options are better? The second one looks better to me |
@SleepWalker Thanks for the context. Yeah, I am ok with option 2. |
…her sidebars. Closes facebook#827, facebook#868
…her sidebars. Closes facebook#827, facebook#868
re-claimed :) |
@SleepWalker it's yours! I've added an "issue: claimed" label so that others will know not to start work on the issue. If you change your mind about the issue, no worries! Just let me know so that I can remove the label and free it up for someone else to claim. I'll check in with you periodically so that we can keep the task updated with the progress. |
🚀 Feature
Allow the same document to be specified in multiple sidebars.
Have you read the Contributing Guidelines on issues?
Yes
Motivation
Improve navigation across the docs
Currently we have a limitation. A document can be child of only one sidebar, which has a bad impact on navigation in case, when you have one sidebar containing "high level" TOC and multiple sidebars with some docs regarding "low level" details for corresponding high level doc.
For example you have the following sidebar.json:
To make the main sidebar shorter, we splitting more specific docs into a separate section with it's own sidebar. In this example document
adding-blog
links to more specific docs, likeadding-comments
. It would be great to have a link toadding-blog
in "blog" sidebar to let the user return back to the "docs" sidebar and high-level article.Pitch
The reason why we can not have one document in multiple sidebars (as far as I know) is because we need a way to decide which sidebar to show for document, that is in multiple sidebars.
To solve this problem I propose to use dot notation. E.g.:
This way we will know, that
adding-blog
should have "docs" sidebar, but at the same time "blog" sidebar will link toadding-blog
too.Alternatively we can use some prefix e.g.
link:
, to show, that this sidebar only links to that doc. This prefix can be extended to allow absolute links too, e.g.link:/storybook
orlink:https://external-docs.com
.And the most universal variant is to use objects instead of strings to allow for more precise and flexible configuration.
The text was updated successfully, but these errors were encountered: