Blackie123
Blackie123

Reputation: 1301

Schema.org data in different places of HTML

I am trying to setup a website for small business and I'd like to use schema.org markup as well. One trouble I encountered is how to deal with the fact that data about the business are in different places of HTML such as:

<h1>Organization Name</h1>

<div>Opening hours among other things here</div>

<div>Address with a map here</div>

How shall I add it to schema.org? + How can I add data that don't make sense in the site, but are possible to include in schema.org (such as URL to map - it doesn't make sense on site since I use Google Maps there, but it makes sense to send link to Google Maps or something).

Upvotes: 0

Views: 157

Answers (2)

unor
unor

Reputation: 96507

One trouble I encountered is how to deal with the fact that data about the business are in different places of HTML

Use the itemref attribute. Example from the spec:

<div itemscope id="amanda" itemref="a b"></div>
<p id="a">Name: <span itemprop="name">Amanda</span></p>
<div id="b" itemprop="band" itemscope itemref="c"></div>
<div id="c">
 <p>Band: <span itemprop="name">Jazz Band</span></p>
 <p>Size: <span itemprop="size">12</span> players</p>
</div>

How can I add data that don't make sense in the site, but are possible to include in schema

If the value is a string, use the meta element. If the value is a URI, use the link element. Those two elements are allowed in the body, if they have the itemprop attribute.

Upvotes: 0

ajax
ajax

Reputation: 1906

One trouble I encountered is how to deal with the fact that data about the business are in different places of HTML such as:

In this case use itemscope itemtype for elements like body or html. Smth like

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

<h1 itemprop="name">Organization Name</h1>
<meta itemprop="openingHours" content="Your openinng hours here in schema.org format - e.g.Mo-Sa 11:00-14:30">Your openinng hours here in whatever you want format for enduser
...
</body>

How can I add data that don't make sense in the site, but are possible to include in schema

Use meta tags for invisible content. Excerpt from doc

Sometimes, a web page has information that would be valuable to mark up, but the information can't be marked up because of the way it appears on the page. The information may be conveyed in an image (for example, an image used to represent a rating of 4 out of 5) or a Flash object (for example, the duration of a video clip), or it may be implied but not stated explicitly on the page (for example, the currency of a price). ... This technique should be used sparingly. Only use meta with content for information that cannot otherwise be marked up.

And example from that page

<div itemscope itemtype="http://schema.org/Offer">
  <span itemprop="name">Blend-O-Matic</span>
  <span itemprop="price">$19.95</span>
  <div itemprop="reviews" itemscope itemtype="http://schema.org/AggregateRating">
    <img src="four-stars.jpg" />
    <meta itemprop="ratingValue" content="4" />
    <meta itemprop="bestRating" content="5" />
    Based on <span itemprop="ratingCount">25</span> user ratings
  </div>
</div>

Upvotes: 1

Related Questions