Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateMeta removes original meta charset and viewport #2332

Open
1 task done
sakihet opened this issue Apr 22, 2020 · 2 comments
Open
1 task done

updateMeta removes original meta charset and viewport #2332

sakihet opened this issue Apr 22, 2020 · 2 comments

Comments

@sakihet
Copy link
Contributor

sakihet commented Apr 22, 2020

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

open a page.

What is expected?

following meta tags which original index.html contains are shown.

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">

What is actually happening?

the tags are removed by updateMeta method.

Other relevant information

@haoranpb
Copy link
Contributor

Thanks for the report, introduced in #2164 .

Not only those two meta tags, it will remove all meta tags in the html template.

@Janne252
Copy link

I literally started using VuePress earlier today and quickly discovered that some meta tags are removed at runtime. This might be common knowledge but the issue can be temporarily (until the issue is resolved) fixed by re-declaring "default" meta tags in the configuration head section:

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

And by providing a customized .vuepress/templates/ssr.html template where the default meta tags have been removed:

<!DOCTYPE html>
<html lang="{{ lang }}">
  <head>
    <title>{{ title }}</title>
    <meta name="generator" content="VuePress {{ version }}">
    {{{ userHeadTags }}}
    {{{ pageMeta }}}
    {{{ renderResourceHints() }}}
    {{{ renderStyles() }}}
  </head>
  <body>
    <!--vue-ssr-outlet-->
    {{{ renderScripts() }}}
  </body>
</html>

As the documentation states, the ssr.html template should be based on the default template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants