【发布时间】:2020-04-30 05:03:38
【问题描述】:
我正在使用 nuxt.js,需要使用 ld+json 为 google 使用结构化数据
我将使用已填充并通过 JSON.stringify 方法运行的动态数据。
我是否正确地将其用于 XXS 脚本?我是否还需要传递 __dangerouslyDisableSanitizers,因为我不确定已提供的文档?
head(){
let user = this.user;
return {
title: 'This is my page title',
meta: [
{ hid: 'description', name: 'description', content: 'This is my description' }
],
script: [
{
innerHTML: JSON.stringify({
'@context': 'http://schema.org',
'@type': 'Website',
'url': `${user}`
}),
type: 'application/ld+json'
}
],
__dangerouslyDisableSanitizers: ['script']
}
},
【问题讨论】: