Vue-meta: Internal JS doesn't process properly with multiple keys

Created on 18 Mar 2017  路  5Comments  路  Source: nuxt/vue-meta

Hello, I'm using nuxt and trying to add internal JS in JSON-LD format.
For the purpose to be short, I added just a couple of properties in the example. Without __dangerouslyDisableSanitizers: ['script'], it doesn't process " leaving it as "

export default {
  head () {
    return {
      script: [
        { innerHTML: '{ "@context": "http://www.schema.org", "@type": "Organization" }', type: 'application/ld+json' }
      ],
      __dangerouslyDisableSanitizers: ['script']
    }
  }
}
enhancement

Most helpful comment

@Atinux Thank you for partially fixing it. I have just checked it and the problem still exists. I haven't tested on a pure vue.js project, here are observations using latest nuxt.alpha4:

Surprisingly, after hot-reload only it does properly render the innerHTML of the script.

However, it fails to render " on the initial render and quotes are still left as "
npm run generate, static generation also doesn't produce correct JSON-LD, leaving quotes as "

All 5 comments

The same thing. Documentation says that we should use __dangerouslyDisableSanitizers(['script']) but in that case I get console error
vue-meta-error
On debugging I see the following data
vue-meta-error2
vue-meta-error3

And then updateTags function crashes

is this issue resolved yet ?

Should be fixed now :)

@Atinux Thank you for partially fixing it. I have just checked it and the problem still exists. I haven't tested on a pure vue.js project, here are observations using latest nuxt.alpha4:

Surprisingly, after hot-reload only it does properly render the innerHTML of the script.

However, it fails to render " on the initial render and quotes are still left as "
npm run generate, static generation also doesn't produce correct JSON-LD, leaving quotes as "

I can confirm @OlzhasAlexandrov findings and it only renders properly after hot-reload only. Fails to render on initial render and npm run generate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathanchase picture nathanchase  路  3Comments

DRoet picture DRoet  路  9Comments

xrei picture xrei  路  10Comments

wilco-superbalist picture wilco-superbalist  路  4Comments

Remcoman picture Remcoman  路  9Comments