How to hide microdata schema?
Asked Answered
C

3

21

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>
Cyndy answered 2/5, 2013 at 11:15 Comment(1)
In general, you shouldn't mark up elements hidden from view with microdata schema. Google penalizes such markup.Camera
M
31

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.

Mannino answered 2/5, 2013 at 15:17 Comment(0)
E
13

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>
Excommunicatory answered 1/5, 2015 at 17:28 Comment(6)
Valid point. I wonder if this is preferred or not by search engines?Unread
It looks as if Google prefers it - developers.google.com/structured-data/schema-orgExcommunicatory
I don't agree with it being better, I think where possible always try to use visible htmlWashwoman
I agree, visible html is better, but that's not what the OP wantedExcommunicatory
Check this link: developers.google.com/structured-data/rich-snippets/reviews "We are in the process of implementing JSON-LD support for this Rich Snippet type. At the current time, we recommend using microdata or RDFa"Bosnia
Hi @MustafaMagdi: I'm a developer advocate at Google working on AMP. We have completed the JSON+LD implementation and prefer JSON+LD nowadays. The link you posted has been updated. Feel free to delete your comment, and I'll delete this one as well.Selfmortification
P
0

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>
Photoengraving answered 8/5, 2018 at 10:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.