如何将breadcrumb添加到现有的JSON+LD列表中
How can i add a breadcrumb to an existing JSON+LD list
我有一个JSON+LD对象,我需要向列表元素动态添加项。如果我从这个代码开始:
var jsonObj = {
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "http://domain.com/",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": 2,
"item":
{
"@id": "http://domain.com/used-equipment/",
"name": "Used Equipment"
}
}
]
}
如何使用JavaScript在位置3添加另一个项目?这可能吗?
当然,您添加它就像添加前两个一样:
[
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "http://domain.com/",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": 2,
"item":
{
"@id": "http://domain.com/used-equipment/",
"name": "Used Equipment"
}
},
{
"@type": "ListItem",
"position": 3,
"item":
{
"@id": "Insert URL here",
"name": "Name of the page"
}
}
]
相关文章:
- 从JSON填充列表(而不是HTML)
- 如何将breadcrumb添加到现有的JSON+LD列表中
- 从Javascript动态构建JSON对象列表
- 将JSON对象列表传递给操作
- 从JSON对列表进行自定义排序
- 调用.ajax方法得到未定义的json结果,返回json格式列表<字符串>
- 呈现通过角度 js 从 API 获取的 json 内容列表
- jQuery Json订单列表中Json值最高的数字
- 使用JQuery淡出JSON ajax列表
- 如何迭代json对象列表
- 如何使用JSON-LD标记面包屑列表中的最后一个非链接项
- 将JSON-LD转换为d3.js节点/链接格式
- Node.js -使用http.get循环遍历要保存在本地的JSON文件列表
- 如何遍历JSON元素列表并使用webdriverio访问它们的属性
- 如何使用node js与mongoose创建一个唯一的json元素列表
- 获取JSON结果列表到现有的HTML选择中
- 获取JSON好友列表
- 从javascript发送一个JSON对象列表到MVC动作
- 将包含JSON对象列表的字符串转换为对象数组
- 检索JSON对象列表中的最后一个对象