Skip to content

Commit 804193a

Browse files
committed
fix($core): preserve original meta charset and viewport (vuejs#2332)
1 parent f54b389 commit 804193a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: packages/@vuepress/core/lib/client/root-mixins/updateMeta.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ export default {
3737
const pageMeta = this.$page.frontmatter.meta || []
3838
// pageMetaTags have higher priority than siteMetaTags
3939
// description needs special attention as it has too many entries
40-
return unionBy([{ name: 'description', content: this.$description }],
41-
pageMeta, this.siteMeta, metaIdentifier)
40+
const ary = [{ name: 'description', content: this.$description }]
41+
if (document) {
42+
ary.push(
43+
{ charset: document.querySelector('meta[charset]').getAttribute('charset') },
44+
{ name: 'viewport', content: document.querySelector('meta[name=viewport]').content }
45+
)
46+
}
47+
return unionBy(ary, pageMeta, this.siteMeta, metaIdentifier)
4248
}
4349
},
4450

0 commit comments

Comments
 (0)