I'm trying to use my own Custome Layout of the vuepress as following steps:
<h1> This is T4V4Home !</h1>
in these <template>
for an indication as follows.<template>
<main
class="home"
aria-labelledby="main-title"
>
<h1> This is T4V4Home !</h1>
<header class="hero">
<h1> This is T4V4Home !</h1>
doesn't appear, seems old "Home.vue" is still used.---
layout: T4V4Home
home: true
#heroImage: /ueda4googleplaystore.png
heroText: Hero Title
tagline: Hero subtitle
actionText: Get Started →
actionLink: /guide/
features:
---
layout: T4V4Home
#home: true
#heroImage: /ueda4googleplaystore.png
heroText: Hero Title
tagline: Hero subtitle
actionText: Get Started →
actionLink: /guide/
features:
How can I activate and use my Custom Layout T4V4Home? Thank you for your suggestions!
Where are you putting your Custom Layout component?
The Custom Layout is working fine for me with VuePress 1.3.0
.
Create a SpecialLayout.vue
files at .vuepress/components/SpecialLayout.vue
, and copy everything in the Home.vue into it. And then add a line <h1>This is a test</h1>
into it.
Change the Frontmatter in the README.md
accordingly.
---
layout: SpecialLayout
heroImage: https://vuepress.vuejs.org/hero.png
heroText: test
tagline:
actionText: Quick Start →
actionLink: /guide/
features:
- title: Feature 1 Title
details: Feature 1 Description
- title: Feature 2 Title
details: Feature 2 Description
- title: Feature 3 Title
details: Feature 3 Description
footer: Made by with ❤️
---
And I successfully get the new HomePage
However, I'm not sure this is exactly what you are looking for, because as you can see in the screenshot above, you'll lose the NavBar
at the top of the page because of Custom Layout.
If you want to preserve the NavBar
, I suggest you try out Theme Inheritance.
Put your customized homepage component at .vuepress/theme/components/Home.vue
. Yes, it needs to be named as Home.vue
to replace the one in the default theme.
Create a index.js
file at .vuepress/theme/index.js
with content
module.exports = {
extend: '@vuepress/theme-default'
}
And don't forget to change the README.md
back to normal.