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>
Overnet
  • 965
  • 3
  • 12
  • 20
  • 1
    In general, you shouldn't mark up elements hidden from view with microdata schema. Google penalizes such markup. – chharvey Nov 20 '17 at 21:36

3 Answers3

30

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.

vanthome
  • 4,816
  • 37
  • 44
ajax
  • 1,896
  • 15
  • 8
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>
Chad
  • 1,139
  • 17
  • 41
  • Valid point. I wonder if this is preferred or not by search engines? – Bradley Flood Jun 15 '15 at 02:01
  • 1
    It looks as if Google prefers it - https://developers.google.com/structured-data/schema-org – Chad Jun 16 '15 at 11:10
  • I don't agree with it being better, I think where possible always try to use visible html – John Magnolia Sep 15 '15 at 13:21
  • 1
    I agree, visible html is better, but that's not what the OP wanted – Chad Sep 16 '15 at 14:10
  • 2
    Check this link: https://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" – Mustafa Magdi Nov 19 '15 at 09:37
  • 5
    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. – Dan Dascalescu May 09 '16 at 18:37
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>
Azhar
  • 693
  • 9
  • 22