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

Sidebar always showing in the home page #825

Closed
3 tasks done
tarikjabiri opened this issue Jun 20, 2022 · 10 comments · Fixed by #829
Closed
3 tasks done

Sidebar always showing in the home page #825

tarikjabiri opened this issue Jun 20, 2022 · 10 comments · Fixed by #829
Labels
enhancement New feature or request theme Related to the theme
Milestone

Comments

@tarikjabiri
Copy link

tarikjabiri commented Jun 20, 2022

Describe the bug

Sidebar always showing in the home page

Reproduction

I just get started
sidebar

Expected behavior

Sidebar hides on home

System Info

windows

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@tarikjabiri tarikjabiri added the bug: pending triage Maybe a bug, waiting for confirmation label Jun 20, 2022
@alexzhang1030
Copy link
Contributor

what's your sidebar configs in .vitepress/config.j(t)s

@alexzhang1030
Copy link
Contributor

i think before you add your sidebar, you need to set the sidebar show path.

like this 👇

image

@brc-dd
Copy link
Member

brc-dd commented Jun 21, 2022

Please provide a minimal reproducible example.

@brc-dd brc-dd added need more info Further information is requested and removed bug: pending triage Maybe a bug, waiting for confirmation labels Jun 21, 2022
@Loveyless
Copy link

change sidebar:{} in config.js
like
image

@Loveyless
Copy link

you can look my config here

@tarikjabiri
Copy link
Author

Hi,

Thank you @alexzhang1030, @Loveyless the problem resolved.

So I have to explicitly define routes when the sidebar should appear that make sense.

if I pass directly an array the side bar always showing, but the way is to pass an object.

Thank you for help.

@tarikjabiri
Copy link
Author

Hi @brc-dd

I suggest that by default hide any sidebar from the layout home.

@brc-dd
Copy link
Member

brc-dd commented Jun 21, 2022

Probably need to change this line:

return frontmatter.value.sidebar !== false && sidebar.value.length > 0

to:

    return frontmatter.value.sidebar !== false && sidebar.value.length > 0 && frontmatter.value.layout !== 'home'

@brc-dd brc-dd added theme Related to the theme and removed need more info Further information is requested labels Jun 21, 2022
@kiaking
Copy link
Member

kiaking commented Jun 21, 2022

Ah yeah, let's do that. Home layout isn't built for Sidebar in mind so the style will never work. Home layout should always hide sidebar 👍

@WebMechanic
Copy link

you can look my config here

thank you, @Loveyless !
that was very useful ! 👍🏻

@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
enhancement New feature or request theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants