Skip to content

Sidebar should update in sub-folders #785

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

Closed
tristan957 opened this issue Aug 30, 2018 · 4 comments
Closed

Sidebar should update in sub-folders #785

tristan957 opened this issue Aug 30, 2018 · 4 comments

Comments

@tristan957
Copy link

tristan957 commented Aug 30, 2018

Feature request

Say I have a structure like this:
image

and my config.js file looks like:

module.exports = {
    themeConfig: {
        nav: [
            { text: "Home", link: "/"},
            { text: "Projects", link: "/"},
            { text: "Wiki", link: "/wiki/"}
        ],
        sidebar: {
            "/wiki/": [
                "",
                "vscode/",
            ],
            "/wiki/vscode/": [
                "",
                "extensions/",
                "go/"
            ],
            "/wiki/vscode/extensions/": [
                "",
                "python",
                "c-cpp"
            ],
            "/wiki/vscode/go/": [
                "",
                "debugging"
            ]
        }
    }
}

I only get to see the sidebar of the /wiki/ directory. When I am in the /vscode/ directory, I want to see the sidebar I defined. Unfortunately all the sidebars under /wiki/ are the same /wiki/ sidebar. The sidebar should be updated on every sub-folder

What problem does this feature solve?

Allows for sub-folders to have unique sidebars

What does the proposed API look like?

Nothing would have to change about config.js, although it might help to allow for nesting like

sidebar: {
    '/wiki/': [
        '',
        'vscode/': [
            '',
            'go/' //,
            // ...
        }
    }
}

How should this be implemented in your opinion?

Similarly to how it is already implemented

Are you willing to work on this yourself?**

I would be willing if I knew where to look.

@hello-sunbaixin
Copy link

#669 ,you can see see

@aaroncaito
Copy link

aaroncaito commented Sep 20, 2018

try this

module.exports = {
    themeConfig: {
        nav: [
            { text: "Home", link: "/"},
            { text: "Projects", link: "/"},
            { text: "Wiki", link: "/wiki/"}
        ],
        sidebar: {
            "/wiki/vscode/extensions/": [
                "",
                "python",
                "c-cpp"
            ],
            "/wiki/vscode/go/": [
                "",
                "debugging"
            ],
            "/wiki/vscode/": [
                "",
                "extensions/",
                "go/"
            ],
            "/wiki/": [
                "",
                "vscode/",
            ]
        }
    }
}

@kaidesu
Copy link

kaidesu commented Oct 8, 2018

☝️ @aaroncaito's solution will work. It's dependent on the order in which you register your navigation items. Reverse it so your global items come last so they're not picked up first.

@ulivz
Copy link
Member

ulivz commented Mar 9, 2019

We're closing this issue as stale as it's more than 20 days without activity, and without an associated Pull Request. Please feel free to continue discussion. We'll reopen this issue if anything actionable is posted.

@ulivz ulivz closed this as completed Mar 9, 2019
@ulivz ulivz added the abandoned label Mar 9, 2019
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

5 participants