对于 Google Rich Snippets,对分类广告建模的最佳方法是使用 GoodRelations 词汇表,http : //purl.org/goodrelations/ 采用 RDFa 语法,但没有提供产品的明确详细信息。
只需使用gr:Offering
如下所示的类:
<div xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gr="http://purl.org/goodrelations/v1#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xml:lang="en" >
<!-- The Classified Ad content -->
<div about="#offering" typeof="gr:Offering">
<div rev="gr:offers" resource="#user1234"></div>
<strong property="gr:name" >Classified ad - headline (e.g. the text in bold)</strong>
<div property="gr:description">Here comes the full text of the classified ad ....
blablabla</div>
<!-- if you have an image, use this pattern -->
<img rel="foaf:depiction" src="http://www.heppnetz.de/rdfa4google/image.jpg" />
<!-- if you know the type of business function (Sell, LeaseOut, Dispose, ProvideService,
attach it like this -->
<div rel="gr:hasBusinessFunction"
resource="http://purl.org/goodrelations/v1#Sell"></div>
<!-- if you can provide the price in a structured form, use this pattern
(needed for Rich Snippets) -->
<div rel="gr:hasPriceSpecification">
<div typeof="gr:UnitPriceSpecification">
<div property="gr:hasCurrency" content="USD" datatype="xsd:string"></div>
<div property="gr:hasCurrencyValue" content="89" datatype="xsd:float"></div>
</div>
</div>
<!-- provide the URI of a deep link to the page -->
<div rel="foaf:page" resource="http://www.heppnetz.de/rdfa4google/tc16.html"></div>
</div>
这在 Google Rich Snippets Testing Tool 中得到验证,您可以在此处看到。
为了您的方便,我刚刚在 GoodRelations Cookbook 中创建了一个相应的食谱:
希望有帮助!