Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 views
in Technique[技术] by (71.8m points)

schema.org - Error in SDTT: "SiteNavigationElement is not a known valid target type for the additionalType property."

I tried a simple example, but the SiteNavigationElement is not working when I test it using the Google Structured Data Testing Tool. It gives the error:

SiteNavigationElement is not a known valid target type for the additionalType property.

The Microdata:

<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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The additionalType property should not be used to create another item (which you are doing with itemscope+itemtype). Its job is to provide the URI of additional types, so the URI itself is the value here.

It seems that you want to mark up each link in your navigation. This is not possible with SiteNavigationElement (it can only be used to mark up the whole navigation, so it’s typically useless).

It would be possible with ItemList, and you could provide SiteNavigationElement as additionalType (but I wouldn’t expect any consumer to make use of this):

<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>

Or as an actual MTE (without additionalType):

<div itemscope itemtype="http://schema.org/ItemList 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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...