diff --git a/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js b/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js index 5b5228c138..e97b7d4c78 100644 --- a/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js +++ b/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js @@ -35,10 +35,19 @@ export default { getMergedMetaTags () { const pageMeta = this.$page.frontmatter.meta || [] + // Fetch the existing meta tags from page so we won't lost them + const webPage = this.currentMetaTags || [] + const webPageMeta = webPage.map(e => { + const obj = {} + for (const key of e.getAttributeNames()) { + obj[key] = e.getAttribute(key) + } + return obj + }) // pageMetaTags have higher priority than siteMetaTags // description needs special attention as it has too many entries return unionBy([{ name: 'description', content: this.$description }], - pageMeta, this.siteMeta, metaIdentifier) + pageMeta, this.siteMeta, webPageMeta, metaIdentifier) } },