[Vuejs]-Implementing ld+json using Nuxt and __dangerouslyDedableSanitizers

7👍

Yes, it is correct.

But since vue-meta v2.1 used by Nuxt.js, the JSON.stringify and __dangerouslyDisableSanitizers are useless if you use the json property:

head(){
    let user = this.user;
    return {
        title: 'This is my page title',
        meta: [
            { hid: 'description', name: 'description', content: 'This is my description' }
        ],
        script: [
            {
                json: {
                    '@context': 'http://schema.org',
                    '@type': 'Website',
                    'url': `${user}`
                }, 
                type: 'application/ld+json'
            }
        ]
    }
},

see vue-meta docs: https://vue-meta.nuxtjs.org/api/#add-json-data

Leave a comment