20

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

我使用的代码如下:

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

3 回答 3

28

如果你想隐藏你的标记,你可以使用元标记。就像 schema.org入门页面中的示例一样

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

对于不可见的链接,使用示例中的标签链接

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

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

于 2013-05-02T15:17:47.080 回答
11

比 css hide 或 meta & link 标签更好,使用 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>
于 2015-05-01T17:28:18.717 回答
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>
于 2018-05-08T10:28:01.433 回答