Closed
Description
Describe the bug
transformHead(context) {
let description = context.pageData?.frontmatter?.layout === "home" ? "Zezombye's Blog" : "Programming, self-improvement, and various stuff";
return [
['meta', { name: 'description', content: description }],
]
},
Although the <meta name="description">
tag is overridden, it doesn't take into account the description, putting instead the default description of "A VitePress site":
This does work if I put og:description
, but Discord picks up the description
tag.
Reproduction
It doesn't seem the build works properly at vitepress.new but by putting the transformHead
hook and removing the default description
field in the config, it should reproduce.
Expected behavior
The tag should be properly overridden
System Info
System:
OS: Windows 10 10.0.17763
CPU: (8) x64 AMD Ryzen 5 1500X Quad-Core Processor
Memory: 12.95 GB / 31.95 GB
Binaries:
Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.7.0 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Chrome: 138.0.7204.49
Internet Explorer: 11.0.17763.2989
npmPackages:
vitepress: ^1.6.3 => 1.6.3
Additional context
VitePress should by default put the description on the home page, but the title if on any other page as the meta description
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.