What is the correct use of schema.org SiteNavigationElement?

后端 未结 10 1834
既然无缘
既然无缘 2020-11-30 02:27

In SEO terms...

Is it best to put the scheme on the parent containing all the links?

10条回答
  •  孤城傲影
    2020-11-30 02:44

    OP's original question contained a good example of code. none of the answers do though ...

    It seems everyone threw in a somewhat random answer ... You can test your schema microdata code using the following official google tool search.google.com/structured-data/testing-tool.

    If you run the proposed answers in this tool you will notice that none give you the expected result: a list of SiteNavigationElement with a name & url

    Some might argue that a whole menu might be considered a "navigation element" but I think it makes more sense for this denomination to designate a single navigation link. Plus if we use the SiteNavigationElement as a marker for the whole menu we have no way of associating names with URLs in the html.

    To achieve this, you need to have each link be encapsulated by an itemscope property and they all need to have their own name and url itemprop (these are singleton as mentioned by @David Harkness, so they have to appear only once per itemprop)

    
    

    The code above will yeld two different navigation elements, each with a name and an URL.

    Note: the itemprop="url" attribute uses the anchor's href attribute as value

提交回复
热议问题