diff --git a/lib/app/dataMixin.js b/lib/app/dataMixin.js index ea8ea40c10..fd003d926f 100644 --- a/lib/app/dataMixin.js +++ b/lib/app/dataMixin.js @@ -49,6 +49,11 @@ export default function dataMixin (siteData) { : selfTitle || 'VuePress' }, $description () { + // #565 hoist description from meta + if (this.$page.frontmatter.meta) { + const descriptionMeta = this.$page.frontmatter.meta.filter(item => item.name === 'description')[0] + if (descriptionMeta) return descriptionMeta.content + } return this.$page.frontmatter.description || this.$localeConfig.description || this.$site.description || '' }, $lang () { diff --git a/lib/build.js b/lib/build.js index 33003a01c4..d43dbb5aa2 100644 --- a/lib/build.js +++ b/lib/build.js @@ -138,7 +138,10 @@ module.exports = async function build (sourceDir, cliOptions = {}) { readline.cursorTo(process.stdout, 0) process.stdout.write(`Rendering page: ${pagePath}`) - const pageMeta = renderPageMeta(page.frontmatter && page.frontmatter.meta) + // #565 avoid duplicate description + const meta = (page.frontmatter && page.frontmatter.meta || []).filter(item => item.name !== 'description') + const pageMeta = renderPageMeta(meta) + const context = { url: pagePath, userHeadTags,