hannoeru / vite-plugin-pages

File system based route generator for ⚡️Vite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable layout for routes

folamy opened this issue · comments

Description

I would like to disable layout for some certain routes, like the landing page.
Is that possible?

Suggested solution

<route lang="yaml">
name: Home
meta:
  layout: false
</route>

Alternative

No response

Additional context

No response

Validations

  • Follow the Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Are you using this plugin: vite-plugin-vue-layouts?

Otherwise vite-plugin-pages does does not have a layout option. You can, however, use the meta value to manipulate your component.

For example:
In your component you add the code you had:

<route lang="yaml">
name: Home
meta:
  layout: false
</route>

And then when route loads the parent component (where is ) you can do something like this:

const shouldShowLayout = computed(() => {
	const { meta } = useRoute();
	return meta.layout !== false;
});

I might be able to help more if more code was provided.