SiteNavigationElement无法正常工作

问题描述:

我尝试了一个简单的例子,但SiteNavigationElement在我使用Google Structured testing tool进行测试时无法正常工作。SiteNavigationElement无法正常工作

<div itemscope itemtype="http://schema.org/WebPageElement"> 
    <link itemprop="additionalType" href="http://schema.org/ItemList" /> 
    <meta itemprop="name" content="navigation_menu" /> 
    <ul> 

    <li itemprop="additionalType" itemscope itemtype="http://www.schema.org/SiteNavigationElement"> 
     <span itemprop="itemListElement"> 
     <a href="http://www.example.com/link_1" itemprop="url"> 
      <span itemprop="name">Link 1</span> 
     </a> 
     </span> 
    </li> 

    <li itemprop="additionalType" itemscope itemtype="http://www.schema.org/SiteNavigationElement"> 
     <span itemprop="itemListElement"> 
     <a href="http://www.example.com/link_2" itemprop="url"> 
      <span itemprop="name">Link 2</span> 
     </a> 
     </span> 
    </li> 

    </ul> 
</div> 

additionalType属性不应被用于创建另一个项目(你与itemscope + itemtype做)。它的工作是提供其他类型的URI,所以URI本身就是这里的值。

看来你想标记你的导航中的每个链接。这不可能与SiteNavigationElement(它can only be used to mark up the whole navigation,所以它的typically useless)。

这将有可能ItemList,你可以提供SiteNavigationElementadditionalType(但我不希望任何消费者利用这一点):

<div itemscope itemtype="http://schema.org/ItemList"> 
    <link itemprop="additionalType" href="http://schema.org/SiteNavigationElement" /> 
    <ul> 
    <li itemprop="itemListElement" itemscope itemtype="http://schema.org/WebPage"> 
     <a href="/link-1" itemprop="url"><span itemprop="name">Link 1</span></a> 
    </li> 
    <li itemprop="itemListElement" itemscope itemtype="http://schema.org/WebPage"> 
     <a href="/link-2" itemprop="url"><span itemprop="name">Link 2</span></a> 
    </li> 
    </ul> 
</div>