设置常规 Schema.org 报价货币价值与 Microdata

Setting general Schema.org offer currency value with Microdata

我的网站有很多使用 Schema.org Offer 类型的商品。

我能以某种方式设置我网站上所有报价的货币吗? 还是我必须为每个报价设置 itemprop="priceCurrency"

不,无法为微数据属性设置站点范围的默认值。

如果单个页面包含多个 Offer 项目,您可以使用 Microdata 的 itemref 属性(参见下面的示例)。但这不适用于跨页面。

<head>
  <title>A page with two offers</title>
  <meta id="site-currency" itemprop="priceCurrency" content="EUR" />
  <!-- this 'meta' element can also be part of the 'body' element -->
</head>

<body>

  <div itemscope itemtype="http://schema.org/Offer" itemref="site-currency">
  </div>

  <div itemscope itemtype="http://schema.org/Offer" itemref="site-currency">
  </div>

</body>