HTML Schema - combining multiple spans - html

I have searched stackoverflow and the web and I can't find an direct answer to this question.
On my website I have added the schema information for the price of an item (see below)
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
Adults and over 10 years old Presale– <span itemprop="price" content="10.00">
<span itemprop="priceCurrency" content="USD">
<span itemprop="availability">
<span itemprop="availabilityStarts" content="2017-01-01T00:00">
<span itemprop="availabilityEnds" content="2017-03-17T23:00">
<span itemprop="inventoryLevel" content="10000">
<span itemprop="url" content="http://www.website.com">
$10</span></span></span></span></span></span></span>
</span>
So as you can see, I have a TON of <span > code. I want to try and reduce this.
I have tested the validation of this snippet via W3C and it validated just fine.
What I am curious about is A) is there a better way, and B) can I just reduce to 1 <span> and include all of that in one so it would look like this:
<span itemprop="priceCurrency" content="USD">
<span itemprop="availability" itemprop="availabilityStarts" content="2017-01-01T00:00" itemprop="availabilityEnds" content="2017-03-17T23:00" itemprop="inventoryLevel" content="10000" itemprop="url" content="http://www.website.com">
Or am I trying to cram too much in one area?

In principle, what you did is fine. However, you currently list the itemprop and content attributes many times on this single <span> element. This is invalid HTML.
Instead, I recommend using data-* attributes.
<span data-price="10.00"
data-price-currency="USD"
data-availability="true"
data-availability-starts="2017-01-01T00:00"
data-availability-ends="2017-03-17T23:00"
data-inventory-level="10000"
data-url="http://www.example.com"></span>
Further reading: using data attributes.

Related

"birthPlace" expects "Place", but I don’t have a full address

I have a database of people who provide mobile notary services. I decided to go with Service instead of just a Person, because the person provides the service.
<div itemscope itemtype="http://schema.org/Service">
<meta itemprop="serviceType" content="Notary" />
<span itemprop="provider" itemscope itemtype="http://schema.org/person">
<span itemprop="name">Derrick Calhoun</span>
<img itemprop="image" src="/headshots/hs-3246356.jpg" alt="" />
<span itemprop="birthPlace">Omaha, NE</span>
</span>
<span itemprop="telephone">555-555-5555</span>
<meta itemprop="ratingValue" content="4" />
Last time available:<time datetime="2015-05-08T19:30">May 8, 7:30pm</time>
Current Location: <span itemprop="place">Lincoln, NE</span>
</div>
Should the birthPlace be formatted differently?
http://schema.org/birthPlace says that the value expected is a Place. However, Place only shows examples of places with full addresses. I only have a city.
I thought about using addressLocality, however, that is supposed to be used on a PostalAddress, which I do not have.
Should I embed Place under provider like this?
<span itemprop="provider" itemscope itemtype="http://schema.org/person">
<span itemprop="name">Derrick Calhoun</span>
<img itemprop="image" src="/headshots/hs-3246356.jpg" alt="" />
<span itemprop="place" itemscope itemtype="http://schema.org/place">
<span itemprop="addressLocality">Seattle</span>
<span itemprop="addressRegion">WA</span>
</span>
</span>
I think I am confused on the basic structure, parent child. Can anyone shed some epic light on this?
The birthPlace property does expect a Place value, but Place doesn’t need to have a full address. You can provide as much properties of Place as you have/want, and the same goes for the PostalAddress value of its address property (where you could provide a addressLocality property etc.).
If you only have a city, you could use a City value, which is a sub-type of Place (those are listed under "More specific Types"):
<span itemprop="birthPlace" itemscope itemtype="http://schema.org/City">
<span itemprop="name">Omaha</span>
</span>
Note that you are making some errors in your Schema.org use:
Schema.org terms are case-sensitive, so person is not the same as Person. (Schema.org follows the convention of starting properties with a lowercase letter, and types with an uppercase letter.)
There is no place property, so itemprop="place" can’t be right.
itemtype="http://schema.org/place" has to be
itemtype="http://schema.org/Place"
itemtype="http://schema.org/person" has to be
itemtype="http://schema.org/Person"

Importxml on attribute

I'm trying to scrape the following content attributes from this site using a googlesheet. Unfortunately every variation i can think of seems to fail
<span itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue" content="3.5"></span>
<span itemprop="ratingCount" content="12"></span>
<span itemprop="reviewCount" content="12"></span>
</span>
I'm looking to extract the values 3.5, 12 & 12 using
=importxml(A2,//*[#id='topOnProduct']/div[2]/span/span[1])
=importxml(A2,//*[#id='topOnProduct']/div[2]/span/span[1]#content)
=importxml(A2,"//span[#itemprop='ratingValue']/#content")
and about 50 other variations on the respective attributes - i'm also having no joy using kiimono. Can anyone advise me where i'm going wrong/show me how to achieve this

Google rich snippets code div

I checked many different sites (official one also) and all the examples display the google snippets code itemscope/itemtype inside a div and the itemprop inside a span.
I'm wondering if this is just a simple way to show samples code or is the only way yo display it.
I have my address in a list so i wrote like this:
<li itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<i class="fa fa-map-marker fa-lg"></i> <p class="labelSocial">Address:</p>
<a href="https://www.google.com/maps/place/Glogauer+Stra%C3%9Fe+21/#52.49226,13.4369,17z/data=!3m1!4b1!4m2!3m1!1s0x47a84fb24234006b:0x36dfe942fb2b5f97" target="_blank">
<p class="addressText">
<span itemprop="streetAddress"> Glougauerstrasse 21, </span> </br>
<span itemprop="postalCode"> 12435 </span>
<span itemprop="addressLocality"> - Berlin </span>
<span itemprop="addressCountry"> (DE) </span>
</p></a>
</li>
is that also correct?
Your Code is fine but you'll have to nest schema.org/PostalAddress under some main category but use of <li> tag is correct. Here is what Google Structured Data testing tools shows for the code you mentioned above-
http://www.google.com/webmasters/tools/richsnippets?q=uploaded:800501214b811a6b2bbfb52e2d77f96d
In order to tell Google and other search engines that address is related to what, we must specify a category and nest postal address inside it. Please see the example, schema.org/PostalAdsress is nested inside LocalBusiness schema:
<div itemscope itemtype="http://schema.org/LocalBusiness">
<h1><span itemprop="name">Beachwalk Beachwear & Giftware</span></h1>
<span itemprop="description"> A superb collection of fine gifts and clothing
to accent your stay in Mexico Beach.</span>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">3102 Highway 98</span>
<span itemprop="addressLocality">Mexico Beach</span>,
<span itemprop="addressRegion">FL</span>
</div>
Phone: <span itemprop="telephone">850-648-4200</span>
</div>

How to specify category for a product in HTML5 Microdata

I'm improving the markup for the Products section of a site of mine by using Microdata. Everything is doing just fine, as the info is being showed in the Google results as expected.
But I think it would be nice to specify a category to a given product. I've searched everywhere and rode every attribute spec found in http://Schema.org/Product but it seems there is nothing there I can use to spec a "Category".
I tried to set itemprop="category" but Google's Rich Snippet Tool gives me this warn: "Page contains property "category" which is not part of the schema.", which is true.
Does anyone knows which property should I use to designate the Category for a Product? Any thoughts on this would be nice.
schema.org/Offer has category property.
A category for the item. Greater signs or slashes can be used to
informally indicate a category hierarchy.
So smth like that will work.
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Kenmore White 17" Microwave</span>
<img src="kenmore-microwave-17in.jpg" alt='Kenmore 17" Microwave' />
<div itemprop="aggregateRating"
itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">3.5</span>/5
based on <span itemprop="reviewCount">11</span> customer reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">$55.00</span>
<link itemprop="availability" href="http://schema.org/InStock" />In stock
<span itemprop="category">LargeCategory > SmallCategory</span>
</div>
</div>
OR
Another option is to use data-vocabulary.org which has category property in its Product class. OK for Google, NOT OK for other Search Engines though. But for Google it will work. Smth like that:
<div itemscope itemtype="http://data-vocabulary.org/Product">
<span itemprop="brand">ACME</span> <span itemprop="name">Executive
Anvil</span>
<img itemprop="image" src="anvil_executive.jpg" />
<span itemprop="description">Sleeker than ACME's Classic Anvil, the
Executive Anvil is perfect for the business traveler
looking for something to drop from a height.
</span>
Category: <span itemprop="category" content="Hardware > Tools > Anvils">Anvils</span>
Product #: <span itemprop="identifier" content="mpn:925872">
925872</span>
<span itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
<span itemprop="rating">4.4</span> stars, based on <span itemprop="count">89
</span> reviews
</span>
<span itemprop="offerDetails" itemscope itemtype="http://data-vocabulary.org/Offer">
Regular price: $179.99
<meta itemprop="currency" content="USD" />
$<span itemprop="price">119.99</span>
(Sale ends <time itemprop="priceValidUntil" datetime="2020-11-05">
5 November!</time>)
Available from: <span itemprop="seller">Executive Objects</span>
Condition: <span itemprop="condition" content="used">Previously owned,
in excellent condition</span>
<span itemprop="availability" content="in_stock">In stock! Order now!</span>
</span>
</div>
You can find out more about this vocabulary here.
I don't get it
On http://schema.org/Product there is category mentioned ( under brand ), still in https://developers.google.com/structured-data/testing-tool/ it apears as an error.
Have they added this attribute recently?

Multiple section for an article marked with schema.org/Article

Suppose to have an article in an HTML Web page. The aim is to markup the content using such a schema (I prefer those provided by schema.org). Hence, one starts to markup the contents by following the schema.org/Article. The point is, if the article belongs to multiple sections, should one put each section in a separate span as follows:
<span itemprop="articleSection">Section1</span> -
<span itemprop="articleSection">Section2</span> -
<span itemprop="articleSection">Section3</span>
or it is equivalent to let them in a unique span like in the following?
<span itemprop="articleSection">Section1 - Section2 - Section3</span>
If your article is part of many different sections, then you should mark each one as a articleSection like in your first example:
<div itemscope itemtype="http://schema.org/Article">
<span itemprop="name">President to throw ceremonial first pitch at Nationals Park</span>
by <span itemprop="author">John Smith</span>
<span itemprop="articleSection">Sports</span> -
<span itemprop="articleSection">Politics</span> -
<span itemprop="articleSection">US News</span>
</div>