Replies: 2 comments
-
Following https://vitepress.dev/guide/extending-default-theme I managed to static content replacing this by using
but dynamic content like anything to declare in the script tag ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I managed to get it work using // .vitepress/theme/MyLayout.vue
<script setup>
import DefaultTheme from 'vitepress/theme';
const {Layout} = DefaultTheme;
import {useData} from 'vitepress';
const {frontmatter} = useData();
</script>
<template>
<Layout>
<template #home-hero-info>
<h1 class="name"><img src="/logo.svg" /></h1>
<p v-if="frontmatter.hero.text" class="text">{{ frontmatter.hero.text }}</p>
<p v-if="frontmatter.hero.tagline" class="tagline">{{ frontmatter.hero.tagline }}</p>
</template>
</Layout>
</template> I leave the discussion open in case there is a better / more idiomatic way |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The default template is great but I would like to change the VPHero component so instead of
<span>{name}</span>
I can put an image (seevitepress/src/client/theme-default/components/VPHero.vue
Line 30 in f60b32f
What is the best way to achieve this ?
Beta Was this translation helpful? Give feedback.
All reactions