vite-plugin-vue-layouts icon indicating copy to clipboard operation
vite-plugin-vue-layouts copied to clipboard

Frontmatter Layout Control

Open yankeeinlondon opened this issue 2 years ago • 3 comments

If I'm not mistaken -- and maybe I am as I'm just getting to the implementation of this -- this plugin uses the router as the primary source to determine which layout to use and I can understand that this is indeed a useful pattern particularly as the "primary pattern" to manage layouts.

If, however, you want to change this at the individual page though it would be really nice if this were able to interact with the defacto Markdown meta format of Frontmatter. Because I've always paired this plugin with vite-plugin-pages and vite-plugin-md I always just assumed this would be there but I believe it is not.

To be clear, what I'd like to see is that when a markdown file has a layout prop defined in Frontmatter it overrides the route based configuration.

---
title: My Post
layout: special
---

# Hello World

Am I just being a numpty and this is in fact supported? Is this something you've considered before? Would you consider?

yankeeinlondon avatar Mar 07 '22 18:03 yankeeinlondon

Note: the only way i know of to do this atm is to put this into a Markdown file:

<route lang="yaml">
meta: 
    layout: 404
</route>

This shifts it but is quite awkward for Markdown ... absolutely fine for VueJS based pages.

yankeeinlondon avatar Mar 07 '22 18:03 yankeeinlondon

Note: i had Anthony approve a PR on vite-plugin-md which opens this a bit (quite indirectly) and hope to have another much bigger PR on vite-plugin-md soon which makes this more explicit.

yankeeinlondon avatar Mar 10 '22 18:03 yankeeinlondon

@yankeeinlondon hi! Has the layout of MD been supported? In my current situation, even if the layout is set, it is still the default layout!As follows, it was actually Deault image

itmanyong avatar Aug 06 '22 10:08 itmanyong

If anyone needs this and wants to do a PR, I'd be happy to review. I don't want to add any dependencies to this package

JohnCampionJr avatar Dec 05 '23 02:12 JohnCampionJr