Skip to content
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

Possible to have subdirectories in Nav? #87

Open
Rombles opened this issue Dec 6, 2020 · 1 comment
Open

Possible to have subdirectories in Nav? #87

Rombles opened this issue Dec 6, 2020 · 1 comment

Comments

@Rombles
Copy link

Rombles commented Dec 6, 2020

Greetings -

I've been working with this project for a few weeks now and it's great, however I was wondering if there was a simple way to configure all treenodes to be collapsed by default. I've tried making a few modifications myself, but none of them have been successful (sometimes they'll work on gatsby develop, but won't launch in Gitlab pages). Here's the layout of the content directory that I'm using:

.

├── index.mdx
├── lab
│   ├── architecture
│   │   ├── 1-hardware.md
│   │   └── 1-network-topology.md
│   └── architecture.md
└── systems-administration
    └── Resize-Filesystem.md

I've been looking around src/components/sidebar/tree.js and was thinking of modifying it like this:


  treeData.items.forEach(item => {
    if (config.sidebar.collapsedNav && config.sidebar.collapsedNav.includes(item.url)) {
      defaultCollapsed[item.url] = true;
    } else if (item.items.length !== 0) { // Assume page has children that should be collapsed
        item.items.forEach(child => {
          defaultCollapsed[child.url] = true;
    } else {
      defaultCollapsed[item.url] = false;
    }

Any tips? Default behavior with subdirectories is pretty unsightly and it would be great to be able to set them collapsed by default.

@swarupdonepudi
Copy link

the description of this issue is misleading... consider changing it to "possible to collapse nav bar by default?" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants