【问题标题】:How to add breadcrumb to Product in Schema.org?如何将面包屑添加到 Schema.org 中的产品?
【发布时间】:2017-06-22 20:53:13
【问题描述】:

我网站的产品页面有面包屑。

Product 类型没有breadcrumb

我这样做:

"@type": "Webpage",
"breadcrumb": {...
"mainEntity":
     { 
        "@type": "Product",
        ...

我说的对吗? (我使用"@type": "Webpage" 仅用于面包屑)

【问题讨论】:

    标签: schema.org breadcrumbs json-ld


    【解决方案1】:

    是的,你的想法是正确的。

    由于面包屑是网页的一部分,而不是产品的一部分,因此 breadcrumb property 仅针对 WebPage 定义。

    请注意,您必须使用WebPage 而不是Webpage。 Schema.org 术语区分大小写。

    对于具有单个产品的页面,您可以考虑使用(更具体的)ItemPage 而不是WebPage

    【讨论】:

    • 我仍然不确定带有面包屑的产品页面的最终 json ld 并且努力寻找示例。
    • @Abram:这是a full JSON-LD exampleWebPageBreadcrumbList。对于Product,您只需将其作为值添加到WebPagemainEntity 属性即可。
    • 显然你不能将 BreadcrumbList 添加到 Product,所以我不得不使用 @graph 来完成这个。
    • @Abram:是的,你不能把它添加到Product,但是(这里的问题是关于什么的)你可以把它添加到WebPage。所以最好的解决方案是使用WebPage,并在其中添加BreadcrumbListProduct
    • @unor 如果我选择不在网页中声明面包屑(即,当面包屑在单独的 json-ld 脚本中时),如何将面包屑连接到网页?我在想我们可以使用 isPartOf,但在 schema.org 中查找面包屑并没有显示此属性。
    【解决方案2】:

    根据 schema.org documentation 的面包屑,您可以使用 BreadcrumbList。所以是这样的:

    {
        "@context": "http://schema.org",
        "@type": "WebPage",
        "breadcrumb": {
            "@type": "BreadcrumbList",
            "itemListElement": [{
                "@type": "ListItem",
                "position": 1,
                "item": {
                    "@id": "https://example.com/dresses",
                    "name": "Dresses"
                }
            }, {
                "@type": "ListItem",
                "position": 2,
                "item": {
                    "@id": "https://example.com/dresses/real",
                    "name": "Real Dresses"
                }
            }]
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多