如何隐藏微数据架构?

时间:2013-05-02 11:15:00

标签: html microdata

我有以下问题。我已将微数据架构添加到我的页面,但我想要隐藏。 有人有想法吗?

我使用的代码如下:

    <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>

3 个答案:

答案 0 :(得分:24)

如果要隐藏标记,可以使用元标记。 例如来自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>

对于不可见的链接,请使用标记 link ,例如。

<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> 

但是,不要过度使用隐藏文本,因为搜索引擎可能会认为它有点垃圾。在您的情况下,我建议将标记放在主页或联系页面的地址块中,并隐藏少量标签。

答案 1 :(得分:11)

优于css hide或meta&amp;链接标签,使用JSON + LD

来自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>

答案 2 :(得分:0)

您也可以尝试将其隐藏起来。它对我来说很好。

<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>