vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.33k stars 1.83k forks source link

Support using dynamic routes params in the frontmatter #3758

Open pepicrft opened 3 weeks ago

pepicrft commented 3 weeks ago

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

I'm using dynamic routes in my project and would love to use a param from the frontmatter, for example, to set the description value. Unfortunately, when I try to do so, I get an invalid value in the generated HTML element:

---
editLink: false
description: {{ $params.description }}
---

The value generated:

<meta name="description" content="[object Object]">

Describe the solution you'd like

I'd love to be able to interpolate content from params in the frontmatter YAML.

Describe alternatives you've considered

I couldn't find any workable alernative

Additional context

No response

Validations

Zhengqbbb commented 3 weeks ago

ref: https://github.com/vuejs/vitepress/issues/2637