saberland / saber

()==[:::::::::::::> Build static sites in Vue.js, without the hassle
https://saber.egoist.dev
MIT License
2.15k stars 112 forks source link

No effect after setting metaInfo #596

Open geekplux opened 4 years ago

geekplux commented 4 years ago

Bug report

Steps to reproduce

setting metaInfo in head or setHead():

  setHead(function() {
    return {
      metaInfo: {
        script: [
          {
            innerHTML: 'console.log("I am in body");',
            type: 'text/javascript',
            body: true
          }
        ]
      }
    }
  })

What is expected?

a <script> tag would be inserted before </body>

What is actually happening?

Other relevant information

may just solve it by upgrading vue-meta to v2.1+ (now 2.0.4 https://github.com/saberland/saber/blob/master/packages/saber/package.json#L66)?

https://vue-meta.nuxtjs.org/api/#pbody

egoist commented 4 years ago

Return the metaInfo properties directly in setHead or head option in your component.

setHead(function() {
    return {
        script: [
          {
            innerHTML: 'console.log("I am in body");',
            type: 'text/javascript',
            body: true
          }
        ]
    }
  })