vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

Customize default page layout

Open JingMatrix opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe.

The default page layout is 'doc', which is hard coded. It will easier the user's life to be able to provide an aletrnative layout so that he doesn't need to write a whole theme.

Describe the solution you'd like

Use dynamic component in VPContent, and add a config option in the themeConfig.

Describe alternatives you've considered

No response

Additional context

No response

Validations

JingMatrix avatar Sep 21 '22 06:09 JingMatrix

Can you explain a bit on what's your use case?

Also I'm not sure what you mean by this:

he doesn't need to write a whole theme.

In your PR, you are adding an option to specify a different component than VPDoc, isn't it equivalent to writing a totally custom theme?

brc-dd avatar Sep 21 '22 14:09 brc-dd

In my case, I want to keep the nav part since you have made many efforts to make it work. Any I feel that the config of layout in the frontmatter is somehow to restrictive.

JingMatrix avatar Sep 21 '22 19:09 JingMatrix

My main motivation is that I want to set frontmatters programtically, but it is readonly. So I have to use different default layouts for different sets of files using locales to specify them.

JingMatrix avatar Sep 21 '22 20:09 JingMatrix

Closing due to inactivity. I think we need more clear explanation on what this issue is trying to achive. When creating custom page layout, it's better to use page instead of doc.

kiaking avatar Oct 21 '22 09:10 kiaking