添加所需的 Schema.org JSON LD 标记
adding required Schema.org JSON LD Markup
我想看看是否有人可以 post 如何动态创建 JSON-LD 以使用 JQuery 创建 google 富人卡的示例?如果有人可以向我展示如何实现它的示例,我将不胜感激。
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "https://www.avenue.com/",
"name": "Home",
}
},{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "https://www.avenue.com/en_US/plus-size-clothing/dresses/",
"name": "Plus Size Dresses",
}
}]
}
</script>
您不应使用 jQuery 创建它。你应该按照这个例子把它放在 isml 模板中:
<script type="application/ld+json">
<isprint value="${JSON.stringify(ldJSON)}" encoding="off"/>
</script>
或者如果您希望对结构进行硬编码:
<script type="application/ld+json">
{
"@context": "${context}",
"@type": "${type}",
"url": "<isprint value="${varURL}" />",
"potentialAction": {
"@type": "${searchType}",
"target": "<isprint value="${theTarget}" />{search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
我想看看是否有人可以 post 如何动态创建 JSON-LD 以使用 JQuery 创建 google 富人卡的示例?如果有人可以向我展示如何实现它的示例,我将不胜感激。
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "https://www.avenue.com/",
"name": "Home",
}
},{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "https://www.avenue.com/en_US/plus-size-clothing/dresses/",
"name": "Plus Size Dresses",
}
}]
}
</script>
您不应使用 jQuery 创建它。你应该按照这个例子把它放在 isml 模板中:
<script type="application/ld+json">
<isprint value="${JSON.stringify(ldJSON)}" encoding="off"/>
</script>
或者如果您希望对结构进行硬编码:
<script type="application/ld+json">
{
"@context": "${context}",
"@type": "${type}",
"url": "<isprint value="${varURL}" />",
"potentialAction": {
"@type": "${searchType}",
"target": "<isprint value="${theTarget}" />{search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>