5

The basic Microdata should be something like:

<div itemscope itemtype="http://schema.org/LocalBusiness">
<a itemprop="url" href="url"><div itemprop="name"><strong>name</strong></div>
</a>
<div itemprop="description">My Description</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">My Address</span><br>
<span itemprop="addressLocality">My City</span><br>
<span itemprop="postalCode">My Zip</span><br>
<span itemprop="addressCountry">My Country</span><br>
</div>
</div>

But can I "split" the itemscope along the page?

Giving an extreme example - Say I have the name at the header of a page, the address in the middle of the page, and the country at the footer.

Would it still be a valid / effective to split the data in such a way? or do I always need to use a cluster.

And if a split is valid, how exactly to perform it? Do I just need to repeat the divs like :

    <div itemscope itemtype="http://schema.org/LocalBusiness">
<div itemprop="name"><strong>name</strong></div>
</a>
    <div itemprop="description">My Description</div>

    </div>

And …

 <div itemscope itemtype="http://schema.org/LocalBusiness">

    <span itemprop="streetAddress">My Address</span><br>

    </div>

And …

   <div itemscope itemtype="http://schema.org/LocalBusiness">

    <span itemprop="country">My Country</span><br>

   </div>

This is my first time considering the use of Microdata - and I just want to make sure that I do it correctly - and I could not see any references to such a "split".

And on the same topic, can I use already existing elements, while adding only the itemscope?

For example:

<div itemscope itemtype="http://schema.org/LocalBusiness">
<h1><div id = "title" class="title" itemprop="name"><strong>name</strong></div></h1>
</a>
unor
  • 92,415
  • 26
  • 211
  • 360
Obmerk Kronen
  • 15,619
  • 16
  • 66
  • 105
  • Did you check `itemref` (as [Michaël Hompus answered](http://stackoverflow.com/a/21107908/1591669))? There’s a similar question on Webmasters: [linking several separated schema.org `
    `s together?](http://webmasters.stackexchange.com/q/52570/17633). Regarding your second question: If I understand you correctly, you ask if it’s [allowed to use other elements than `div`/`span`?](http://stackoverflow.com/a/20889900/1591669)
    – unor Jan 15 '14 at 13:45

2 Answers2

8

The easiest is to have everything in the same hierarchical tree. But you can split things using itemref. See this example from the same document you linked to:

In the following example, the "a" property has the values "1" and "2", in that order, but whether the "a" property comes before the "b" property or not is not important:

<div itemscope>
  <p itemprop="a">1</p>
  <p itemprop="a">2</p>
  <p itemprop="b">test</p>
</div>

Thus, the following is equivalent:

<div itemscope>
  <p itemprop="b">test</p>
  <p itemprop="a">1</p>
  <p itemprop="a">2</p>
</div>

And the following:

<div itemscope itemref="x">
  <p itemprop="b">test</p>
  <p itemprop="a">2</p>
</div>
<div id="x">
  <p itemprop="a">1</p>
</div>
unor
  • 92,415
  • 26
  • 211
  • 360
Michaël Hompus
  • 3,349
  • 24
  • 35
  • +1 Using Google's testing tool (http://www.google.com/webmasters/tools/richsnippets) shows that this does work so I think this should be the accepted answer. – Hidden Hobbes Oct 22 '14 at 13:44
  • But `itemprop="a"` that is inside `
    ` will be considered as a property of WebPage, and this will cause validation error for a WebPage object
    – Eugene Mala Mar 18 '15 at 14:29
  • The only isssue with this one as a solutions is if you have to reference from multiple places you end up duplicating the ID value, which then makes the document structure invalid in many contexts. Still, this is pretty much the answer. – Ted Stresen-Reuter Oct 02 '19 at 17:16
2

No, a parser will probably see what you're suggesting as 3 separate Local Business entities.

But you can have other text between the various properties in http://schema.org/LocalBusiness as follows:

<div itemscope itemtype="http://schema.org/LocalBusiness">
  <a itemprop="url" href="url"><div itemprop="name"><strong>name</strong></div></a>
  <p>
     This paragraph is not used by schema.org
     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam blandit pretium
     massa, in consectetur velit. Vivamus aliquam, turpis in pellentesque pulvinar,
     lectus diam fermentum velit, quis fermentum arcu turpis in orci. Duis egestas
     urna vel velit suscipit mollis. Nulla sed diam massa.
  </p>
  <div itemprop="description">My Description</div>
</div>
Paul Watson
  • 361
  • 1
  • 3
  • 8
  • So just to be clear - what you are actually saying is that in my ( extreme scenario ) example I would need to wrap the whole page in an `itemscope` div ? ( for example the wrapper div ?? ) – Obmerk Kronen Jan 13 '14 at 08:49
  • Yes, or just attach the itemscope line to the body element – Paul Watson Jan 13 '14 at 10:36
  • Thanks, Last question - So actually it does not disturb if in the middle I have 1000 other things ? ( images, links, advertisments ..) – Obmerk Kronen Jan 13 '14 at 11:25
  • No, any application parsing the Microdata in your page will ignore anything that's not explicitly defined as a itemprop of the itemtype. So in my example in my first answer, the paragraph with the "Lorem ipsum" text in it would be completely ignored in terms of Microdata. – Paul Watson Jan 13 '14 at 12:08