Closed
Description
If I define a meta-description (frontmatter) in a page, it does not seem to override the meta-description defined in .vuepress/config.js
.vuepress/config.js
module.exports = {
title: 'vuepress is awesome',
description: 'this should be the default description for pages that do not define their own meta descriptions',
};
Example page
---
meta:
- name: description
content: my custom meta description
---
I would expect that my custom meta description
is rendered, but the default description from .vuepress/config.js
and the frontmatter-description are rendered.
These are the code parts that seem to be responsible for the page-meta processing:
Line 76 in 1bbfa43
Line 131 in 1bbfa43
Line 153 in 1bbfa43
I'm not sure how to tackle this issue... maybe we could inject the global description into the page.frontmatter.meta
object instead of the siteConfig.head
object? Something like this:
// lib/prepare.js
const frontmatter = yaml.loadFront(content)
if (siteConfig.description && !frontmatter.meta.description) {
frontmatter.meta.description = siteConfig.description
}