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

Extending @vuepress/theme-default Layout.vue causes the Sidebar to disappear #1045

Closed
1 task done
spiltcoffee opened this issue Nov 27, 2018 · 1 comment
Closed
1 task done
Labels
type: bug Something isn't working

Comments

@spiltcoffee
Copy link
Contributor

  • I confirm that this is a issue rather than a question.

Bug report

Version

vuepress 1.0.0-alpha.24

Steps to reproduce

  1. Create a Layout that extends @vuepress/theme-default/layouts/Layout.vue

CustomLayout.vue

<script>
import Layout from "@vuepress/theme-default/layouts/Layout.vue";

export default {
  extends: Layout
}
</script>
  1. Use Layout

index.md

---
layout: CustomLayout
---

What is expected?

Default layout to appear as expected

What is actually happening?

The sidebar is always hidden.

I believe this is to do with the following function:

shouldShowSidebar () {
const { frontmatter } = this.$page
return (
!frontmatter.layout &&
!frontmatter.home &&
frontmatter.sidebar !== false &&
this.sidebarItems.length
)
},

Checking for !frontmatter.layout causes the sidebar to always be hidden if you inherit the default Layout.vue in this way.

It's possible to get around the issue by redefining shouldShowSidebar() in the inherited component, but I'm wondering whether there should even be a check for !frontmatter.layout anyway, seeing as LayoutDistributor.vue will replace the whole component if frontmatter.layout is defined.

Other relevant information

  • Your OS: Windows 10
  • Node.js version: 10.6.0
  • Browser version: Chrome 70
  • Is this a global or local install? local
  • Which package manager did you use for the install? npm 6.4.0
@ulivz ulivz closed this as completed in 8dd418e Nov 29, 2018
@ulivz ulivz added the type: bug Something isn't working label Nov 29, 2018
@ulivz
Copy link
Member

ulivz commented Nov 29, 2018

Fixed at 8dd418e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants