【发布时间】:2022-11-23 14:53:28
【问题描述】:
我在 webflow(一个网站平台)工作,并在内容字段中粘贴一个 JSON-LD 脚本。该字段映射到网页的部分。
JSON 脚本中的所有双引号 " 都被切换为 "
是否有一行代码可以添加到脚本中以将它们切换回来?
我尝试在 </script> 标签之前插入以下内容
.replace(/&quot;/g, '\"')
和.replace(/&quot;/g, '\\"')
没有一个工作。
这是代码在发布之前在后端的样子
<script type='application/ld+json'>
{Schema}
.replace(/"/g, '\\"')
</script>
这就是它在实时站点上呈现的内容
<script type='application/ld+json'>
{ "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{ "@type": "Question", "name": "How quickly can I get my certificate of insurance?", "acceptedAnswer": { "@type": "Answer", "text": Certificates are usually issued 24 hours after the policy is bound." } }]
}
.replace(/"/g, '\\"')
</script>
【问题讨论】:
标签: javascript html json content-management-system