SDTT 中的错误:“SiteNavigationElement 不是附加类型属性的已知有效目标类型." [英] Error in SDTT: "SiteNavigationElement is not a known valid target type for the additionalType property."

查看:56
本文介绍了SDTT 中的错误:“SiteNavigationElement 不是附加类型属性的已知有效目标类型."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了一个简单的示例,但是当我使用 Google 结构化数据测试工具.它给出了错误:

<块引用>

SiteNavigationElement 不是 additionalType 属性的已知有效目标类型.

微数据:

<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">链接 1</span></a></span><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">链接 2</span></a></span>

解决方案

additionalType 属性不应用于创建另一个项目(您正在使用 itemscope+<代码>项目类型).它的工作是提供附加类型的 URI,因此 URI 本身就是这里的值.

您似乎想标记导航中的每个链接.SiteNavigationElement 无法做到这一点(它只能用于标记整个导航,所以它通常没用).

使用 ItemList 是可能的,并且您可以将 SiteNavigationElement 作为 additionalType 提供(但我不希望任何消费者使用其中):

<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">链接 1</span></a><li itemprop="itemListElement" itemscope itemtype="http://schema.org/WebPage"><a href="/link-2" itemprop="url"><span itemprop="name">链接 2</span></a>

或者作为一个实际的 MTE(没有 additionalType):

<ul><li itemprop="itemListElement" itemscope itemtype="http://schema.org/WebPage"><a href="/link-1" itemprop="url"><span itemprop="name">链接 1</span></a><li itemprop="itemListElement" itemscope itemtype="http://schema.org/WebPage"><a href="/link-2" itemprop="url"><span itemprop="name">链接 2</span></a>

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>

解决方案

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>

这篇关于SDTT 中的错误:“SiteNavigationElement 不是附加类型属性的已知有效目标类型."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆