Clarify use of interpolations inside Markdown headings

pull/4844/head
Daniel Rosenberg 2 months ago committed by GitHub
parent e2a8ba04c5
commit e8b5909074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -21,6 +21,19 @@ You can access frontmatter data via the `$frontmatter` global in Vue expressions
{{ $frontmatter.title }} {{ $frontmatter.title }}
``` ```
However, avoid using a Vue expression in this manner inside Markdown headings:
```md
---
title: Docs with VitePress
editLink: true
---
# {{ $frontmatter.title }}
```
The heading's anchor and accessibility attributes, as well as search index contents, are produced **before** Vue evaluates the expression, which will result in the string `frontmatter-title` being used in those places instead of the actual title.
## title ## title
- Type: `string` - Type: `string`

Loading…
Cancel
Save