Google now supporting new version of Schema.org BreadcrumbList?

不想你离开。 提交于 2019-12-11 14:39:32

问题


It appears as though Google has now implemented Schema.org version 2 and Google's own examples fail Google's validation test. For example, here's is Google's example JSON-LD code for breadcrumbs:

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "item": {
                "@id": "https://example.com/arts",
                "name": "Arts"
            }
        },
        {
            "@type": "ListItem",
            "position": 2,
            "item": {
                "@id": "https://example.com/arts/books",
                "name": "Books"
            }
        },
        {
            "@type": "ListItem",
            "position": 3,
            "item": {
                "@id": "https://example.com/arts/books/poetry",
                "name": "Poetry"
            }
        }
    ]
}
</script>

Yesterday, when I pasted the above code into a test.html file, Google's validation tool validated it as a "Pass".

Today, it fails. It appears that you now have to explicitly define a mainEntity. But they haven't bothered to update their docs.

Does anyone know where to find the official documentation on using JSON-LD? Schema.org doesn't offer much and appears to also be out-dated. I managed to get the following code to pass the test:

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "WebPage",
    "mainEntity": {
        "@context": "http://schema.org",
        "@type": "BreadcrumbList",
        "itemListElement": [
            {
                "@type": "ListItem",
                "position": 1,
                "item": {
                    "@id": "http://www.example.com",
                    "name": "Home"
                }
            },
            {
                "@type": "ListItem",
                "position": 2,
                "item": {
                    "@id": "http://www.example.com/shop.com",
                    "name": "Shop"
                }
            }
        ]
    }
}
</script>

What I'm worried about this is:

Let's say you also define a product on the same page, using microdata, will the search engines treat the breadcrumb list as the mainEntity? i.e. Will it rank higher in search results, than the product will?


回答1:


You have to separate concerns:

  • Schema.org is a vocabulary.
  • JSON-LD is a syntax.
  • Google is a consumer that supports structured data that

    • is provided in the JSON-LD syntax and
    • makes use of the Schema.org vocabulary.

Schema.org can’t be "out-dated": they are of course the canonical source of their own types/properties. If some of their types/properties get deprecated, they typically keep being part of the vocabulary.

The "official documentation on using JSON-LD" is the W3C Recommendation (linked above).

If I understand your issue correctly, your problem is with Google: their documentation vs. their testing tool. They document that they support Schema.org’s BreadcrumbList type, but their testing tool doesn’t recognize this type:

The attribute itemtype has an invalid value.

(Although this error message refers to "itemtype", which is a Microdata attribute, it comes up no matter which supported syntax you test.)

There is nothing you can do about it. The first snippet is valid JSON-LD and it’s an appropriate use of the Schema.org vocabulary. The fact that Google even documents it that way makes it seem likely that their testing tool is bugged currently (which happened several times before).

About your second snippet: using mainEntity that way is probably not what you want to convey. You are saying that the breadcrumbs would be the main entity of the web page, but that would be very uncommon. Typically the main entity is an Article etc.



来源:https://stackoverflow.com/questions/32274356/google-now-supporting-new-version-of-schema-org-breadcrumblist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!