Skip to content

Page title is not interpolated inside <title> element #4640

Open
@paul-louyot

Description

@paul-louyot

Describe the bug

When the title of a page is the result of variable interpolation, it shows correctly inside a h1 element, but the value of the variable does not end up inside the <title> element of the rendered HTML page.

Let's say I have this inside example.md of the starter template:

<script setup>
const title = "VitePress 💙 StackBlitz"
</script>

# {{ title }}

Then the title element will contain {{ title }} | VitePress

Reproduction

https://stackblitz.com/edit/vite-pivzggyp?file=docs%2Fexample.md

Expected behavior

The title element contains the value of the variable, e.g VitePress 💙 StackBlitz | VitePress

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vitepress: latest => 1.6.3

Additional context

Image

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions