2

I know this can be done - but I just can't find an example.

I have an Schema.org Organization div in the header of my page.

The page is an article so I have to add a publisher. I don't want to duplicate data and I know that you can refer to other items on the page by ID but I'm just not sure of the overall syntax.

This is where I'm at. I'm still getting 2 errors, stating that the logo and name fields are required - but isn't that what I'm referencing?

<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>
John Ohara
  • 2,821
  • 3
  • 28
  • 54
  • 1
    Possible duplicate of [HTML5 Microdata - itemref to another itemscope (Person works for Organization)](http://stackoverflow.com/questions/17186058/html5-microdata-itemref-to-another-itemscope-person-works-for-organization) (in [my answer](http://stackoverflow.com/a/33984412/1591669), I linked to many examples) – unor Nov 17 '16 at 13:14
  • @unor - the concept is the same but its a slightly different scenario and I'm still getting validation errors which ever way I try. Do add the itemref to the article or the publisher? – John Ohara Nov 17 '16 at 13:20
  • Then your question seems to be about your specific problem -- in which case you have to include the markup in your question. Regarding where to place the `itemref` attribute: see [the "tl;dr" in my answer](http://stackoverflow.com/a/33984412/1591669) – unor Nov 17 '16 at 13:26
  • @unor - I've added markup. – John Ohara Nov 17 '16 at 13:53

1 Answers1

1

As explained in my answer, the element you want to add has to have the itemprop attribute. So this is the structure you need:

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

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

(This should only be used on pages where the Organization is added as publisher; otherwise it’s invalid HTML+Microdata if the itemprop="publisher" doesn’t belong to an itemscope.)

If you now replace the <asp:…> elements with actual HTML elements, Google’s SDTT is able to understand what you want to convey: it adds the name/url/logo properties to the Organization item, and it adds this Organization item as publisher to the Article item.

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

The errors Google’s SDTT still reports are not actual errors with your Schema.org/Microdata. These are just properties that Google requires for getting their search result features. In the case of logo, Google wants to see an ImageObject value.

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • Thanks for your help. I'm sure I'd tried this configuration before but it does seem to work now. The odd thing is that now my logo (as well as the article image) ar reporting issues - logo.itemtype has an invalid value. Before the change the logo validated fine. – John Ohara Nov 17 '16 at 14:44