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

feat: add multi sidebar support (#38) #49

Merged
merged 2 commits into from
Jul 21, 2020

Conversation

kiaking
Copy link
Member

@kiaking kiaking commented Jul 5, 2020

close #38

This PR adds multi sidebar support. It does only support nesting array of objects as currently that is the only format supported by the array sidebar.

{
  sidebar: {
    '/guide/': [
      { text: 'Getting Started', link: '/guide/getting-started' },
      ...
    ],

    '/guide/nested/': [
      { text: 'Nested Index', link: '/guide/nested/' },
      ...
    ],

    // Fallback supported too.
    '/': [
      { text: 'Index', link: '/' },
      { text: 'Root', link: '/root' }
    ]
  }
}
  • children property in each object works as well.
  • Active state of Navbar item is not working correctly. It needs to compare correct path but thinking to create another PR for it.
  • URL without trailing slash acts differently than VuePress. Currently, if we access /guide, it renders /guide.html. If we access /guide/, it renders /guide/index.html. I'm leaving it as is for now but maybe we should have follow up PR for it...?

Screen Shot 2020-07-05 at 19 49 01

* path is `/guide/getting-started.html`, this method will return `/guide/`.
* Always with a trailing slash.
*/
export function resolvePath(path: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think resolvePath is a bit unclear here, would it better to be getPathDirname or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Let me change this one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 🙌

@yyx990803 yyx990803 merged commit 050fa4c into vuejs:master Jul 21, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi Sidebar
3 participants