与 div 之外的数据相关的架构标记

Schema markup relating to data outside of div

我知道这是可以做到的 - 但我就是找不到例子。

我的页面 header 中有一个 Schema.org 组织 div。

该页面是一篇文章,因此我必须添加发布者。我不想重复数据,我知道您可以通过 ID 引用页面上的其他项目,但我不确定整体语法。

这就是我所在的位置。我仍然收到 2 个错误,指出徽标和名称字段是必需的 - 但我所引用的不是这个吗?

<div id="organization" itemscope itemtype="http://schema.org/Organization">
    <asp:HyperLink ID="lnkHome" runat="server" itemprop="url">
        <asp:Image ID="imgLogo" runat="server" itemprop="logo" />
    </asp:HyperLink>
    <meta itemprop="name" content="My Co" /> 
</div>

<article itemscope itemtype="http://schema.org/Article">
    <span itemprop="publisher" itemscope itemtype="http://schema.org/Organization" itemref="organization"></span>
</article>

作为explained in my answer,您要添加的元素必须具有itemprop 属性。所以这是你需要的结构:

<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization" id="organization">
</div>

<article itemscope itemtype="http://schema.org/Article" itemref="organization">
</article>

(只能在Organization添加为publisher的页面使用,否则如果itemprop="publisher"不属于则无效HTML+微数据itemscope.)

如果您现在将 <asp:…> 元素替换为实际的 HTML 元素,Google 的 SDTT 能够理解您想要传达的内容:它添加了 name/url/logo 属性添加到 Organization 项,并将此 Organization 项作为 publisher 添加到 Article 项。

<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization" id="organization">
  <a itemprop="url" href="/example">
    <img itemprop="logo" src="example.png" alt="" />
  </a>
  <meta itemprop="name" content="My Co" />
</div>

<article itemscope itemtype="http://schema.org/Article" itemref="organization">
</article>

错误 Google 的 SDTT 仍然报告不是您的架构的实际错误。org/Microdata。这些只是 Google 获取其搜索结果功能所需的属性。在logo.

的情况下