-
In my app, I define site-wide title and description: export default {
title: 'Dan Kim',
description: 'I write software and design interfaces.'
} My Markdown files look the following way: ---
layout: post
title: Hello, world
description: Lorem ipsum dolor sit amet
---
Lorem ipsum dolor sit amet
<!--more-→
More content Can I reuse an excerpt for meta description? |
Beta Was this translation helpful? Give feedback.
Answered by
ElMassimo
Feb 1, 2023
Replies: 1 comment 1 reply
-
Yes, but currently the most robust option to do that is a bit verbose: <script setup lang="ts">
const { page } = $(usePage())
const description = $computed(() => page.excerpt)
</script>
<template>
<Head>
<meta name="description" :content="description"/>
<meta property="og:description" :content="description"/>
<meta property="twitter:description" :content="description"/>
</Head>
</template> In some cases, you might be able to get away with: <script setup lang="ts">
const { frontmatter, page } = $(usePage())
frontmatter.description = page.excerpt
</script> Try building the site and check the results. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dankimio
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, but currently the most robust option to do that is a bit verbose:
In some cases, you might be able to get away with:
Try building the site and check the results.