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

base option not generating correct multi sidebar #231

Closed
TheDutchCoder opened this issue Feb 10, 2021 · 8 comments · Fixed by #234
Closed

base option not generating correct multi sidebar #231

TheDutchCoder opened this issue Feb 10, 2021 · 8 comments · Fixed by #234
Assignees
Labels
bug Something isn't working

Comments

@TheDutchCoder
Copy link

TheDutchCoder commented Feb 10, 2021

Describe the bug
Yesterday's PR (#223) introduced the ability to have a base option work with dev mode. However this change breaks sidebar implementations and they no longer show up.

This happens in both dev and prod builds.

To Reproduce
The following config works without the base option set, but not with it:

module.exports = {
  lang: 'en-US',
  title: 'Chalk UI 🐼',
  description: 'Vue Component Library',

  // base: '/test/',

  themeConfig: {
    docsDir: 'docs',

    nav: [
      { text: 'Components', link: '/components/' },
      { text: 'Style Guide', link: '/style-guide/' },
    ],

    sidebar: {
      '/components/': getComponentsSidebar(),
      '/style-guide/': getStyleGuideSidebar(),
    },
  }
}

function getComponentsSidebar () {
  return [{
    text: 'Components',
    children: [
      { text: 'Button', link: '/components/button' },
    ],
  }]
}

function getStyleGuideSidebar () {
  return [{
    text: 'Style Guide',
    children: [
      { text: 'Components', link: '/style-guide/components' },
      { text: 'State Machines', link: '/style-guide/state-machines' },
      {
        text: 'Tests',
        link: '/style-guide/tests',
        children: [
          { text: 'Components', link: '/style-guide/tests/components' },
          { text: 'State Machines', link: '/style-guide/tests/state-machines' },
        ],
      },
    ],
  }]
}

Expected behavior
The sidebars to appear (I think it might not resolve the files correctly anymore)

System Info

  • vitepress version: 0.12
  • vite version: 2.0.0-beta.50
  • Node version: 12.19
  • OS version: MacOS 11.2
@TheDutchCoder TheDutchCoder added the bug: pending triage Maybe a bug, waiting for confirmation label Feb 10, 2021
@TheDutchCoder
Copy link
Author

It also appears that sidebar: 'auto' no longer works (even though there was a PR merged for it not too long ago: #224)

@kiaking kiaking added bug Something isn't working and removed bug: pending triage Maybe a bug, waiting for confirmation labels Feb 10, 2021
@kiaking
Copy link
Member

kiaking commented Feb 10, 2021

Confirmed. Sidebar not correctly showing with multi sidebar. Must be forgetting to take in base option in account when generating the sidebar in the theme.

@TheDutchCoder I can't confirm auto not working. It's working for me. What happens for you?

@kiaking kiaking changed the title Merged base PR breaks sidebars base option not generating correct sidebar Feb 10, 2021
@TheDutchCoder
Copy link
Author

@kiaking same result as specifying the sidebar manually, it's hidden in the CSS (and missing all children).
I'll upgrade all dependencies and see if that yields a different result.

@kiaking kiaking self-assigned this Feb 11, 2021
@kiaking kiaking changed the title base option not generating correct sidebar base option not generating correct multi sidebar Feb 11, 2021
@kiaking
Copy link
Member

kiaking commented Feb 11, 2021

@TheDutchCoder I made a fix at #234. This should fix multi sidebar issue, but not sure about auto. Do you still see issue when you set sidebar to auto?

@TheDutchCoder
Copy link
Author

Let me quickly check!

@TheDutchCoder
Copy link
Author

TheDutchCoder commented Feb 11, 2021

@kiaking in 0.12.0 I still have that issue yes, Let me add some screenshots, maybe it helps

Config + structure:
image

Generated on dev server:
image

@kiaking
Copy link
Member

kiaking commented Feb 11, 2021

Oh OK that's expected. You don't have heading to show on the sidebar. Try adding Level 2 headers to the markdown. Not sure if we should completely hide Sidebar when there're no headings in the markdown though 🤔 But that's some other issues to be discussed 👍

@ecanquiz
Copy link

ecanquiz commented Mar 5, 2022

Everything works fine for me with vitepress dev docs and with "vitepress serve docs" but when I use it on github it uploads it to me but the header and the menu sidebar don't appear. Help me please...

@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
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants