-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
feat(content-docs): displayed_sidebar front matter #5782
Conversation
✔️ [V2] 🔨 Explore the source changes: aa6240e 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61e3a28793201c000858562c 😎 Browse the preview: https://deploy-preview-5782--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5782--docusaurus-2.netlify.app/ |
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
@slorber Please review this for the next week. Let's make it into the next release because I'm constantly asked of this on Discord. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that looks great 👍
|
||
The `ref` type is identical to the [`doc` type](#sidebar-item-doc) in every way, except that it doesn't set the association. It only registers itself as a link but doesn't take part in generating navigation metadata. When [generating pagination](#generating-pagination) and displaying sidebar, `ref` items are completely ignored. | ||
When you add doc Y to sidebar X, it creates a two-way binding: sidebar X contains a link to doc Y, and when browsing doc Y, sidebar X will be displayed. But sometimes, we want to break either implicit binding: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break either implicit binding?
I'm not native but that sounds weird to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break the forward binding, or backward binding 😄 I think it makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, seems good enough, we can improve later if anyone complains :D
@Josh-Cena It is great, when to release? |
Probably in a week or two, no solid plan yet :) |
@Josh-Cena thanks for your hard work! :-) BTW, how to download a |
@Josh-Cena could you give me a advice to download a |
You can use the |
@Josh-Cena download worked, but it is display in the |
@blling Please don't use GitHub as a support forum. We have a lot of other channels: https://docusaurus.io/community/support |
For your question, we don't have a way to exclude things from the autogenerated slice as of now, so your only chance is to put this file out of the docs directory. |
@Josh-Cena maybe add a I will use |
Hmm, I think using the |
Ah yeah, that should work too 🤔 |
@slorber @Josh-Cena there is a warning when use |
I see, but it works right? |
it works :-) |
@Josh-Cena we don't have any ref api doc for this: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter Do you want to add it? Otherwise I'll do it |
Interesting—yes, you can send a PR and I may take a look |
Motivation
Resolve #5686. This PR:
displayed_sidebar
front matter option;Deprecates theref
item type (in documentation);ref
because it's a nice alternative to setting bothpagination_*
anddisplayed_sidebar
front matter.We will add
hide_sidebar
in another PR where we hopefully port the same DX to other front matter options likehide_table_of_contents
.There's a slight behavior inconsistency between
ref
anddoc
when generating pagination:ref
are completely ignored whiledoc
will become the next and prev. I personally think that's fine.Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Added two sidebar cases
Some unit tests