question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] Option to toggle docs category open by default

See original GitHub issue

🚀 Feature

Add a new property on the @docusaurus/plugin-content-docs SidebarItemCategory to set the default state as opened. This should affect only to that one category, no all the categories on the docs.

Have you read the Contributing Guidelines on issues?

Yes.

Motivation

Improve UX.

Pitch

Imagine docs with just two root elements:

  • Introduction
  • Reference v

Where Reference is a category with few other documents inside. This would allow to have this Reference category open by default which would be easier for the user to navigate/explore.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:34 (32 by maintainers)

github_iconTop GitHub Comments

1reaction
lex111commented, Apr 24, 2020

@jsjoeio in short, this line of code does not need to be changed. I would add an additional condition under which item must be expanded.

https://github.com/facebook/docusaurus/blob/510bec65325dcada1c14627910087d29749b16d5/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.js#L109

Please see the docs https://v2.docusaurus.io/docs/next/docs#collapsible-categories

I recommend checking the changes directly on the v2 website, rather than creating a new one.

Other than that, you don’t need to use Verdaccio for such changes at all, it only takes more effort from you. The workflow is described here https://github.com/facebook/docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md#testing It is very simple.

1reaction
amimascommented, Mar 18, 2020

Not sure if this really improves ux.

If I’m a new user to the site and by default the references section is open, I’d probably find it confusing because I need to know the introduction docs first before getting into other details.

The scenario mentioned in the original post is probably an example but it feels more like content organization issue rather than needing a feature from the ssg tool.

Docusaurus also lets you create multiple sidebars that contains different navigation. That could also be an option depending the actual use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sidebar - Docusaurus
The themeConfig.docs.sidebar.autoCollapseCategories option would collapse all sibling categories when expanding one category. This saves the ...
Read more >
How to Display Specific Video Category Tab as a Default on ...
The setting can be found under the Video > Filterable Tabs > Default Tab on Page Load. Choose option Custom and enter a...
Read more >
Word Options (Advanced) - Microsoft Support
Among the options in this section, you can change where Word saves your changes by selecting File Locations . Or choose to open...
Read more >
.toggle() | jQuery API Documentation
A map of additional options to pass to the method. duration (default: 400 ). Type: Number or String. A string or number determining...
Read more >
Viewing PDFs and viewing preferences, Adobe Acrobat
2 ) You have the option Restore Last View Settings When Reopening Documents selected in Edit > Preferences > Document category. Resolution. Use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found