-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
NavBar missing with Custom Layout #1469
Comments
I think the problem lies on line 45-48 of the [routes.js](https://github.com/vuejs/vuepress/blob/e5d8ed4655b42e975a1d72286bc859257b3d2eb9/packages/%40vuepress/core/lib/node/internal-plugins/routes.js) file let code = `
{
name: ${JSON.stringify(componentName)},
path: ${JSON.stringify(pagePath)},
component: GlobalLayout,
beforeEnter: (to, from, next) => {
ensureAsyncComponentsLoaded(${JSON.stringify(layout || 'Layout')}, ${JSON.stringify(componentName)}).then(next)
},${_meta ? `\n meta: ${JSON.stringify(_meta)}` : ''}
}` the default Layout from the Theme cannot be used in conjunction with the |
For example: vuepress/packages/@vuepress/theme-default/layouts/Layout.vue Lines 8 to 11 in dc52412
|
And in conclusion, it is an expected behavior. |
@shigma Sorry to reply on a closed topic but my question is exactly the same. I'm using the default theme but I do not have the theme folder. The documentation is a bit confusing when it says "while only keeping the navbar", because actually it's not showing the navbar:
So, after a simple install, could you please clarify how we can have the default-theme folders in the project? Thanks |
It's working creating the home.vue inside components folder and importing the component on readme.md file (home page) like this:
I'm just not if it's the correct approach. Cheers |
@shigma I think the previous approach made more sense in v.0x, now if I want a custom layout with the default theme I have to manually add the navbar and the sidebar so that it is consistent across the site. It made way more sense before to just have to pass a frontmatter variable that controlled having a navbar and sidebar...just my 2cents. The doc should also be updated to reflect the change that you stated if that's the new format. |
@shigma could you provide clarification between |
I second better documentation and definitely more examples. At this moment I am still not entirely sure what is the layout: frontmatter actually doing, where that vue file should be placed, and how to chain it to the inherited components. Please explain differently for (1) someone writing a complete theme for export as an NPM and (2) someone wanting just to override a few special pages with local override templates, e.g. a carousel or a custom 404 page, and (3) someone who wants to write part of the site in vue single page format and how to define the frontmatter in vue instead of md. Browsing tutorials around the web is totally confusing particularly because of the 0.x to 1.x changes. |
I have the same problems that some custom layout pages(actually a lot) need to have the navbar to keep the site consistency. Though to import default theme is not a perfect solution, but it solves my problem. import Navbar from '@vuepress/theme-default/components/Navbar'
<Navbar @toggle-sidebar="toggle"/> There two issues to point out: |
Bug report
I created my own custom component and placed it in the appropriate folder. I then called said component in my markdown file frontmatter using the syntax below:
The component displays just fine but the navbar is gone which is contrary to what is indicated in the documentation (https://v1.vuepress.vuejs.org/theme/default-theme-config.html#custom-layout-for-specific-pages)
Am I missing something?
Version
vuepress@1.0.0-alpha.44 is the version I am on
Steps to reproduce
What is expected?
I should be seeing the navbar
What is actually happening?
It's no visible with the custom layout
Other relevant information
The text was updated successfully, but these errors were encountered: