在一个关于视频网站的项目中,我必须准备有关有资格观看视频资料的国家的信息。
提供此信息的标记如下:
<span itemprop="eligibleRegion" itemscope itemtype="http://schema.org/Country">
<meta itemprop="name" content="DE" />
</span>
<span itemprop="eligibleRegion" itemscope itemtype="http://schema.org/Country">
<meta itemprop="name" content="FR" />
</span>
但是,有大量视频产品符合所有国家/地区的条件。因此,显而易见的做法是将上述标记重复大约 200 次,这似乎不是最佳解决方案。
是否有可能实现相同的结果 [产品在所有国家/地区的可用性] 但数据量要小得多?
类似于:
<span itemprop="eligibleRegion" itemscope itemtype="http://schema.org/Country">
<meta itemprop="name" content="[allCountries] or [allRegions]" />
</span>
一个可能的解决方案
我想到一个可能的解决方案是使用来自 https://schema.org/geoRadius 的 geoRadius并为其指定一个非常大的半径(?!)
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCircle">
<div itemprop="geoMidpoint" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="42.362757" />
<meta itemprop="longitude" content="-71.087109" />
</div>
<meta itemprop="geoRadius" content="[100000....]" />
</div>
然而,这似乎不是一个很好的解决方案。
最佳答案
作为eligibleRegion
属性还需要 Text
作为值,您可以使用类似的东西:
<meta itemprop="eligibleRegion" content="DE" />
<meta itemprop="eligibleRegion" content="FR" />
如果您有更多符合条件的区域,您可能需要使用 ineligibleRegion
属性(property)代替。
如果您想传达内容在任何地方都是合格的,您当然可以简单地省略任何 eligibleRegion
/ineligibleRegion
属性。这并没有明确说明情况确实如此,但可能暗示了这一点。
使用 GeoShape
/GeoCircle
覆盖整个地球的值(value)观将是明确这一点的一种方式。
顺便说一下,如果你可以使用 JSON-LD 而不是 Microdata,你可以使用类似这样的东西,这当然更紧凑:
"eligibleRegion": ["DE", "FR"],
关于html - schema.org 中 "eligibleRegion = All Countries"的最小标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39962500/