vuepress-theme-maker icon indicating copy to clipboard operation
vuepress-theme-maker copied to clipboard

SSR's `meta` tags do not show up in build's `<head>`

Open please-wait opened this issue 4 years ago • 2 comments

Going to https://80shuo.com/ the html does not have <meta charset="utf-8"> or any other meta tag in HTML head, but those are specified in ssr:

https://github.com/80maker/vuepress-theme-maker/blob/fe72943fff9c97c7e02ad2053308d1a5c293f785/templates/ssr.html#L4

Where could this issue come from?

please-wait avatar Apr 28 '21 19:04 please-wait

😮Really? You are right. But, I just view the source of html, it has the right meta tag. I think it probably caused by vuepress itself, because the site of https://vuepress.vuejs.org has this issue too.

80maker avatar Apr 29 '21 02:04 80maker

A solution I found is to include the following in config.js

head: [
    ["meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }],
    ["meta", { charset:"utf-8" }]
 ]

It's not ideal because iirc these tags are recommended to be in the first 1024 characters of the file, and right now they are under a load of other tags. But a modern browser understands them just fine it appears.

Perhaps their version upgrade will fix it in the future.

please-wait avatar Apr 29 '21 06:04 please-wait