4

How can I tag information that is not displayed on the page with the Microdata format?

Typically, we do not want to display publisher/author info on the page, but Google requires this info for Articles, and they have a complex structure.

I do not want to put this data in hidden span/div or anything, so I thought I'd use the meta tag. But how do I specify the logo and name of the publisher entity using metas? Do I need to use itemref somehow?

<section itemscope itemtype="http://schema.org/Article">
 <meta itemprop="keywords" content="kw1, kw2" />
 <meta itemprop="publisher" content="© My Company" /><!-- ??-->

I've already looked at Using a different image for microdata that isn't displayed in the article?, but is it possible to achieve what I want without using JSON-LD? If no, can I use both JSON-LD and meta/tag descriptions?

Community
  • 1
  • 1
David
  • 33,444
  • 11
  • 80
  • 118
  • **1.** Could you include the complex structure in your question? Or do you even wonder about the `keywords` and `publisher` properties? **2.** Are you aware that Google does not *require* these properties in general, but only if you want to get one of their search result features? Nothing bad happens if you don’t provide them. – unor Jun 09 '16 at 13:02
  • 2
    @unor 1. By complex, I meant that the value for the author item is not a text/integer value, but rather an object with properties (name) with subitems (e.g. logo) 2. I was following the guidelines there: https://developers.google.com/search/docs/data-types/articles#article_types. Yes, I know nothing bad will happen, but I'd still like to do it the right way. – David Jun 09 '16 at 13:32

1 Answers1

6

I think you have two (in some cases three) options using Microdata.

meta/link + div

The most simple solution is to use meta/link elements for properties with non-item values, and div elements for properties with item values.

<section itemscope itemtype="http://schema.org/Article">
  <meta itemprop="keywords" content="kw1, kw2" />
  <div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="My Company" />
  </div>
</section>

meta/link elements are hidden by default, and div elements that contain nothing else than meta/link elements don’t show anything either.

meta/link + itemref

If you don’t want to use div elements, it’s possible to use meta elements for representing an item. But then you have to

  • provide an empty content attribute (ugly), and
  • use the itemref attribute for every property you want to add to this item.
<meta itemscope itemprop="publisher" content="" itemtype="https://schema.org/Organization" id="pub" itemref="pub-name" />

<meta itemprop="name" content="My Company" id="pub-name" />

<section itemscope itemtype="http://schema.org/Article" itemref="pub">
  <meta itemprop="keywords" content="kw1, kw2" />
</section>

Note that this does not work for top-level items, because the meta element requires an itemprop attribute (which can’t be empty).

(meta/link +) itemid

In some cases it might be possible to reference URIs for the items (instead of embedding them), e.g., if you have another page that contains the data about the publisher.

However, note that it’s not clear if Google supports this.

<section itemscope itemtype="http://schema.org/Article">
  <meta itemprop="keywords" content="kw1, kw2" />
  <link itemprop="publisher" href="/publisher#this" />
</section>
<!-- on the page /publisher -->

<section itemscope itemtype="http://schema.org/Organization" itemid="#this">
  <h1 itemprop="name">My Company</h1>
</section>
unor
  • 92,415
  • 26
  • 211
  • 360
  • Thank you very much. I'll go with solution #1, which seems to work fine in Google's testing tool. Silly me for now thinking about div with invisible meta content – David Jun 09 '16 at 14:38