How to hide microdata schema? - html

I have the following problem. I have add the microdata schema to my page but I want hidden.
Anyone have an idea?
The code that I've use is the following:
<div itemscope itemtype="http://schema.org/LocalBusiness">
<a itemprop="url" href="http://www.example.net/"><div itemprop="name"><strong>Audiosky Mobile Development</strong></div>
</a>
<div itemprop="description">Description/div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="addressLocality">Los Angeles</span><br>
<span itemprop="addressRegion">California</span><br>
<span itemprop="postalCode"></span><br>
<span itemprop="addressCountry">USA</span><br>
</div>
</div>

If you want to hide your markup you may use meta tags.
Like in example from schema.org Getting Started 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>
For invisible links use tag link like in example.
<div itemscope itemtype="http://schema.org/Offer">
<span itemprop="name">Blend-O-Matic</span>
<span itemprop="price">$19.95</span>
**<link itemprop="availability" href="http://schema.org/InStock">**Available today!
</div>
However don't overuse hidden text as Search Engines may judge it somewhat spammy. In your case I advise to put markup in address block at your main or contact page and hide only few tags.

better than css hide or meta & link tags, use JSON+LD
example from https://schema.org/LocalBusiness
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "LocalBusiness",
"address": {
"#type": "PostalAddress",
"addressLocality": "Mexico Beach",
"addressRegion": "FL",
"streetAddress": "3102 Highway 98"
},
"description": "A superb collection of fine gifts and clothing to accent your stay in Mexico Beach.",
"name": "Beachwalk Beachwear & Giftware",
"telephone": "850-648-4200"
}
</script>

You can also try this to hide it from user. It working fine for me.
<address style="display: none;">
<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>
</address>

Related

Is this proper Schema.org/Microdata markup for a building?

I am trying to add Microdata notation (using Schema.org) to my website which basically talks about buildings. I’ve been reading a lot about it but I’m still having trouble figuring out where to use itemscope, itemtype and itemprop.
Can anybody tell me if this is good Microdata/Schema.org markup or if I’m missing something?
<div class="infobox infobox_building" itemscope itemtype="http://schema.org/LandmarksOrHistoricalBuildings">
<!-- Building Name -->
<h1 class="page_title">Puente Golden Horn Metro</h1>
<!-- Architect -->
<div class="data_row architect" itemscope itemtype="http://schema.org/creator">
<div class="tag cell">Arquitecto</div>
<div class="value cell">
Michel Virlogeux
Hakan Kıran
</div>
</div>
<!-- Height -->
<div class="data_row" itemscope itemtype="http://schema.org/height">
<div class="tag cell">Altura</div>
<div class="value cell" itemprop="QuantitativeValue">65m</div>
</div>
<!-- Width -->
<div class="data_row" itemscope itemtype="http://schema.org/width">
<div class="tag cell">Ancho</div>
<div class="value cell" itemprop="QuantitativeValue">12,6m</div>
</div>
<!-- Location -->
<div class="data_row" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div class="tag cell">Ubicación</div>
<div class="value cell" itemprop="streetAddress">Arap Cami Mahallesi, Beyoğlu/İstanbul, Turquía</div>
</div>
</div> <!-- infobox -->
You seem to confuse properties and types.
In Microdata, properties get specified in the itemprop attribute, while types get specified in the itemtype attribute.
If you only use the vocabulary Schema.org, you’ll use the full URI for types (itemtype="http://schema.org/PostalAddress"), while you use just the slug for properties (itemprop="address").
In Schema.org, it’s easy to see what is what, because they follow the convention that the first letter of properties is lowercase (address), and the first letter of types is uppercase (PostalAddress).
Syntactically, you are doing it correctly with address+PostalAddress, but wrong with creator+Person and height/width+QuantitativeValue.
That said, you are also making some vocabulary errors. The LandmarksOrHistoricalBuildings type can’t have a creator nor a height nor a width property in the first place.
You can see which properties a type can have by visiting the type’s page (LandmarksOrHistoricalBuildings) and checking the first table.
I also had the same problem or question like you. Because my buildings are not even historical (when is a building historical?), I created my own schema:
{
"#context":
{
"Place": "http://schema.org/Place",
"name": "http://purl.org/dc/terms/title",
"alternateName":"http://purl.org/dc/terms/title",
"description": "http://purl.org/dc/terms/description",
"geo": "http://schema.org/geo",
"image":
{
"#id": "http://schema.org/image",
"#type": "#id"
},
"latitude":
{
"#id": "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
"#type": "xsd:decimal"
},
"longitude":
{
"#id": "http://www.w3.org/2003/01/geo/wgs84_pos#long",
"#type": "xsd:decimal"
},
"containedInPlace":"http://schema.org/Place",
"containsPlace":"http://schema.org/Place",
"architect":"http://schema.org/Creator",
"Address": "http://www.w3.org/2006/vcard/ns#Address",
"address": "http://www.w3.org/2006/vcard/ns#address",
"street": "http://www.w3.org/2006/vcard/ns#street-address",
"locality": "http://www.w3.org/2006/vcard/ns#locality",
"region": "http://www.w3.org/2006/vcard/ns#region",
"country": "http://www.w3.org/2006/vcard/ns#country",
"postalCode": "http://www.w3.org/2006/vcard/ns#postal-code",
"meter": "http://purl.org/measurement#meter",
"kilometer": "http://purl.org/measurement#kilometer",
"feet": "http://purl.org/measurement#feet",
"miles": "http://purl.org/measurement#miles",
"xsd": "http://www.w3.org/2001/XMLSchema#"
}
}
But I am not sure whether google or some other search services will get the idea. If you have any improvements or ideas to the schema let me know!

Show discount in Schema.org

I have a product which has reduced price. I want to show both prices - original and discounted. Is there a way to mark this in Schema.org?
For now I have something similar:
<ul class="productPriceList" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<li class="productPriceList">
<div class="price red"><span class="" itemprop="price">4302</span> <span itemprop="priceCurrency" content="USD">$</span></div>
<span class="price crossOut" itemprop="price">26890</span> <span itemprop="priceCurrency" content="USD">$</span> <span class="product-promo">84</span>% off
</li>
</ul>
This shows as:
offers
#type: Offer
price: 4302
priceCurrency: USD
price: 26890
priceCurrency: USD
Your current markup doesn’t convey which price is the old/new one. You shouldn’t use that.
You could use two PriceSpecification items instead (as value for the priceSpecification property). With validFrom and validThrough you can specify the dates when the old price was valid and since when the new price is valid.
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div itemprop="priceSpecification" itemscope itemtype="PriceSpecification">
<s>$ <span itemprop="price">26890</span></s>
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="validThrough" content="…" />
</div>
<div itemprop="priceSpecification" itemscope itemtype="PriceSpecification">
$ <span itemprop="price">4302</span>
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="validFrom" content="…" />
</div>
</div>
(Note that the span element can’t have a content attribute in Microdata. I replaced it with a meta element.)

Microdata for organization

I'm trying to do the right mikrodaty layout for the site. Do I understand how to act . For example I go to https://schema.org/Organization and go through the list to the bottom . Opt for each tag (name, adress, streetAddress and so on ) . If possible, I need to fill out all the tags , am I right?Now I got something like this:
<div itemscope itemtype="http://schema.org/Organization">
<div class="historyb" id="historyb">
<span class="historyh2" itemprop="name">MyName</span>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">
Street & number of house
</span>
<span itemprop="addressLocality">City</span>,
<span itemprop="postalCode">111111</span>
</div>
<a href="mailto:MyEmail#gmail.com" itemprop="email">
MyEmail#gmail.com
</a>
<span itemprop="foundingDate">Date</span>
<span itemprop="foundingLocation">City</span>
<span itemprop="legalName">Full Name</span>
<a itemprop="url" href="#"><img itemprop="logo" src="http://www.mysite.ru/images/logo.png" /></a>
</div>
This is valid according to Google's test tool but you might want to include addressCountry and addressRegion for https://schema.org/Place

Arabic and latin characters get mixed up

I am currently doing the technical part of creating an Arabic version of our website. The other languages should not be affected by this, so basically the changes to the markup must be minimal.
What I have (in English):
<div class="location_description"> <span itemscope itemtype="http://schema.org/AdministrativeArea">
<span class="glyph featcl_T"></span>
<span itemprop="name">Canton of Obwalden</span>,</span>
<span class="coords" itemprop="geo" itemtype="http://schema.org/GeoCoordinates">46.77°N 8.43°E 3238m asl
<meta itemprop="elevation" content="3238">
<a target="_blank" title="Geonames" href="http://www.geonames.org/2658357"><span class="glyph edit">
</span>
</a>
<meta itemprop="latitude" content="46.77">
<meta itemprop="longitude" content="8.43">
</span>
</div>
"Canton of Obwalden" comes from a database, and can be Arabic too, but can also be in any other language.
Our translator did the translations for "N", "E" and "m asl", and the result is a total mess... http://jsfiddle.net/stby04/xzj5czb5/
So, how do I bring that in the correct order for every possible combination of languages?
add dir="rtl" in every tag in which you expect to have Right to Left Text
div class="arabic">
<div class="location_description"> <span dir="rtl" itemscope="" itemtype="http://schema.org/AdministrativeArea">
<span dir="rtl" class="glyph featcl_T"></span>
<span dir="rtl" class="arabic" itemprop="name">Kanton Obwalden</span>,</span> <span class="arabic" itemprop="geo" itemscope="" itemtype="http://schema.org/GeoCoordinates">46.77°ش 8.43°ق 3238متر فوق سطح البحر<meta itemprop="elevation" content="3238"><a target="_blank" title="Geonames" href="http://www.geonames.org/2658357"><span class="glyph edit"></span>
</a>
<meta itemprop="latitude" content="46.77">
<meta itemprop="longitude" content="8.43">
</span>
</div>
</div>

HTML5 Microdata - itemref to another itemscope (Person works for Organization)

The website of an organization, say "Sun Industries", would like to add a list of employees. The address and contact information of the organization is already present at the webpage, but the list of employees would be somewhere else.
So we have
<div id="organization" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Sun Industries</span>,
<span itemprop="location" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Technologies Street 42</span>,
<span itemprop="addressLocality">Venustown</span>
<span itemprop="postalCode">98765</span>
</span>
</span>
</div>
and later on in the HTML5 code we will have
<div id="employee-1" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales Manager</span>
</div>
How do we link the two objects "organization" and "employee-1" together?
I tried to add the following child to the "employee-1" object
<meta itemprop="worksFor" itemscope itemtype="http://schema.org/Organization" itemref="organization">
but that did not work (at least not in Google's Structured Data Testing Tool).
How can I use the microdata property itemref correctly in this case?
Just to be clear, I also tried the following:
Add itemprop="worksFor" to the "organization" object.
Add itemref="organization" to the "employee" object.
So
<div id="organization" itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Sun Industries</span>,
...
</div>
...
<div id="employee-1" itemscope itemtype="http://schema.org/Person" itemref="organization">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales Manager</span>
</div>
but that gave me a Warning: Page contains property "worksfor" which is not part of the schema. for the "organization" object.
Well, actually your last code snippet looks fine.
Maybe with Yandex Validator the output will be more clear
person
itemType = http://schema.org/Person
worksfor
organization
itemType = http://schema.org/Organization
name = Sun Industries
name = John Doe
jobtitle = Sales Manager
Couple of other working examples.
<body>
<div id="organization" itemscope itemtype="http://schema.org/Organization" itemref="employee-1">
<span itemprop="name">Sun Industries</span>,
<span itemprop="location" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Technologies Street 42</span>,
<span itemprop="addressLocality">Venustown</span>
<span itemprop="postalCode">98765</span>
</span>
</span>
</div>
<div id="employee-1" itemprop="employee" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales Manager</span>
</div>
</body>
Gives the following:
organization
itemType = http://schema.org/Organization
employee
person
itemType = http://schema.org/Person
name = John Doe
jobtitle = Sales Manager
name = Sun Industries
location
place
itemType = http://schema.org/Place
address
postaladdress
itemType = http://schema.org/PostalAddress
streetaddress = Technologies Street 42
addresslocality = Venustown
postalcode = 98765
Or this
<body>
<div id="employee-1" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales Manager</span>
<meta itemprop="worksFor" itemscope itemtype="http://schema.org/Organization" itemref="organization">
</div>
<div id="organization">
<span itemprop="name">Sun Industries</span>,
<span itemprop="location" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Technologies Street 42</span>,
<span itemprop="addressLocality">Venustown</span>
<span itemprop="postalCode">98765</span>
</span>
</span>
</div>
</body>
That results in
person
itemType = http://schema.org/Person
name = John Doe
jobtitle = Sales Manager
worksfor
organization
itemType = http://schema.org/Organization
name = Sun Industries
location
place
itemType = http://schema.org/Place
address
postaladdress
itemType = http://schema.org/PostalAddress
streetaddress = Technologies Street 42
addresslocality = Venustown
postalcode = 98765
Spec is not very clear about using itemref but example helps
<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>
Your last example is correct.
(Google’s testing tool no longer gives the mentioned error. Back then they were probably not up to date with new additions to the Schema.org vocabulary.)
Specification
Links to the itemref specifications:
W3C’s Microdata (Note): itemref
WHATWG’s HTML (Living Standard): Microdata: itemref
tl;dr:
You specify itemref on the element (with itemscope) to which you want to add properties.
You specify id on the element (with itemprop) which you want to add.
Examples
A minimal example:
<div itemprop="worksFor" itemscope itemtype="http://schema.org/Organization" id="org">
<!-- this property (worksFor) gets added to the Person item below -->
</div>
<div itemscope itemtype="http://schema.org/Person" itemref="org">
<!-- looks for the element with the ID "org" -->
</div>
This is equivalent to:
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
</div>
</div>
Other examples:
adding meta elements from the head
adding the property specified on the body element to elements that are children of that body
adding an Event to an Action
adding a name property from a child item to the parent item
add a property that is a child of an Offer item to the parent Product item instead of the Offer
adding breadcrumb to WebPage
adding the Hotel as a branchOf an Organization
adding several related products to a Product
adding the Product to an Offer
two examples of relating Event items: either via superEvent or via subEvent
To keep in mind
The itemref attribute can only be used for elements in the same document.
You can reference multiple elements from one itemref attribute (separate the ID tokens with space characters).
The referenced element may be a container for multiple properties.
You have to make sure that the referenced elements are not children of an element with itemscope, otherwise their properties will also be added to this item (but you can circumvent this by adding a dummy itemscope).
There are 2 ways to links schema data together.
itemid: Link 2 complete objects (ie Organisation & Person)
itemref: Link 1 complete object to 1 incomplete object (ie Article & Comments)
1st one is easy. All you do is add the itemid property onto item you wish to link and add a link on other item:
<div itemid='#org' itemscope itemType='http://schema.org/Organization'>
<!-- ..... -->
</div>
<article itemscope itemType='http://schema.org/Article'>
<link itemprop='publisher' href='#org'>
</article>
Second one is not so easy. What if the comments for your blog post are somewhere far away. How do you connect them to your blog post? You can create an empty item with an id and then connect it to your blog post like so:
<div id="comments" itemscope>
<span itemprop="commentCount">0</span>
</div>
<div id="words" itemscope>
<span itemprop="wordCount">0</span>
</div>
We don't need to give comments an itemType. All we need is to add itemscope. This way we get no validation errors. Now we can link the comments back to blog post like so:
<div itemscope itemtype="http://schema.org/BlogPosting" itemref="comments words">
<!-- .... -->
</div>
Tada! We even managed to import wordCount as well.