为什么我的架构服务无法正确识别?

问题描述 投票:0回答:1

我有点怀疑我的定价表是否根据架构/微数据正确设置。你能帮我验证一下吗? Schema 自己的验证器工具没有错误或警告。但是,当通过该工具进行验证时,“头发颜色”服务似乎未被识别为服务(正确),因为我已包含

PriceSpecification
minPrice

架构验证器工具截图

<table>
  <thead>
    <tr>
      <th scope="col">Treatment</th>
      <th scope="col">Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th colspan="2" scope="col">Cuts and hair colours</th>
    </tr>
    <tr itemscope itemtype="https://schema.org/Service">
      <td itemprop="name">Consultation<br /> <small>when you need ideas</small></td>
      <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <span itemprop="price" content="0">Free</span>
        <meta itemprop="priceCurrency" content="DKK" />
      </td>
    </tr>
    <tr itemscope itemtype="https://schema.org/Service">
      <td itemprop="name">Lady haircut<br /> <small>including wash</small></td>
      <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <span itemprop="price" content="660">660</span>
        <span itemprop="priceCurrency" content="DKK">kr.</span>
      </td>
    </tr>
    <tr itemscope itemtype="https://schema.org/Service">
      <td itemprop="name">Hair colour<br /> <small>including wash</small></td>
      <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <div itemscope itemtype="https://schema.org/PriceSpecification">
          <span itemprop="minPrice" content="1650">from 1.650</span>
          <span itemprop="priceCurrency" content="DKK">kr.</span>
        </div>
      </td>
    </tr>
  </tbody>
</table>
html seo schema.org microdata structured-data
1个回答
0
投票

问题是您的标记不正确:您需要将

PriceSpecification
包装在
Offer
的相应容器/属性内(这就是它被检测为“独立”的原因):

PriceSpecification 的实例可能会显示为 以下属性

https://schema.org/PriceSpecification

在您的情况下,

priceSpecification
属性是合适的(因为您使用
Offer
),因此,您需要将
PriceSpecification
包装在
priceSpecification
容器内:

<tr itemscope itemtype="https://schema.org/Service">
  <td itemprop="name">Hair colour<br /> <small>including wash</small></td>
  <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
    <div itemprop="priceSpecification">
      <div itemscope itemtype="https://schema.org/PriceSpecification">        
      <span itemprop="minPrice" content="1650">from 1.650</span>
      <span itemprop="priceCurrency" content="DKK">kr.</span>
      </div>
    </div>
  </td>
</tr>

完整代码:

<table>
  <thead>
    <tr>
      <th scope="col">Treatment</th>
      <th scope="col">Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th colspan="2" scope="col">Cuts and hair colours</th>
    </tr>
    <tr itemscope itemtype="https://schema.org/Service">
      <td itemprop="name">Consultation<br /> <small>when you need ideas</small></td>
      <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <span itemprop="price" content="0">Free</span>
        <meta itemprop="priceCurrency" content="DKK" />
      </td>
    </tr>
    <tr itemscope itemtype="https://schema.org/Service">
      <td itemprop="name">Lady haircut<br /> <small>including wash</small></td>
      <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <span itemprop="price" content="660">660</span>
        <span itemprop="priceCurrency" content="DKK">kr.</span>
      </td>
    </tr>
    <tr itemscope itemtype="https://schema.org/Service">
      <td itemprop="name">Hair colour<br /> <small>including wash</small></td>
      <td itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <div itemprop="priceSpecification">
          <div itemscope itemtype="https://schema.org/PriceSpecification">        
          <span itemprop="minPrice" content="1650">from 1.650</span>
          <span itemprop="priceCurrency" content="DKK">kr.</span>
          </div>
        </div>
      </td>
    </tr>
  </tbody>
</table>
© www.soinside.com 2019 - 2024. All rights reserved.