JSON-LD内容中的字符串值是否需要转义?例如,Google建议采用以下方法来为站点搜索提供提示:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.example-petstore.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://query.example-petstore.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
但如果我的网站搜索URL包含多个查询参数怎么办?对于target的值中的字符应该被转义吗?例如:
"target": "https://query.example-petstore.com/search?foo=bar\u0026q={search_term_string}",
同样的问题也适用于在 JSON-LD 标记中标记多个常见的 schema.org 类型。例如,在组织(Organization) -> sameAs 中标记 Google+ 社交资料链接:如果我的组织资料是
https://plus.google.com/+BeardsAreSweet
那应该表示为:
"sameAs": ["https://plus.google.com/+BeardsAreSweet"]
或者"sameAs": ["https://plus.google.com/\u002bBeardsAreSweet"]
更重要的是,这真的有关紧要吗?
https://example.com/search?q=abc&filter=true
时,我使用转义版本https://example.com/search?q=abc&filter=true
是否可以?请帮忙。 - basZero