Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4 tasks done
paul-louyot opened this issue Mar 21, 2025 · 1 comment
Open
4 tasks done

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

paul-louyot opened this issue Mar 21, 2025 · 1 comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@paul-louyot
Copy link

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

@paul-louyot paul-louyot added the bug: pending triage Maybe a bug, waiting for confirmation label Mar 21, 2025
@Tynopia
Copy link

Tynopia commented Mar 21, 2025

Hi, I also reported this yesterday. With my PR, you can skip the old logic and use the compile function to generate the compiled title.

Issue: #4637
PR: #4630

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants