Google网站搜索中的元标记

时间:2010-03-04 17:22:16

标签: meta-tags google-search

我正在计划实施Google网站搜索(并支付费用,以便我可以访问XML)。我想知道的一件事是可以在其中使用自定义元标记。

我从同事那里听到了,但没有证实。寻找答案没有给出任何答案(也许是因为你不能?)

有人知道吗?

修改:我希望能够从搜索结果中检索这些元标记,以便能够为不同类型的网页提供不同的样式。

2 个答案:

答案 0 :(得分:6)

是的,你可以这样做,虽然不是,据我所知,使用meta标签。相反,谷歌允许您将自定义属性放入HTML中,然后可以从您从Google自定义搜索结果API中获取的XML中检索这些属性。

看一看 http://code.google.com/apis/customsearch/docs/snippets.html了解有关其工作原理的更多信息。 Structured Data部分概述了您可以在页面中添加自定义元数据的具体方法,以便Google将其与每个搜索结果一起交还给您。最简单的似乎是一个PageMap,它是HEAD中的HTML注释,如下所示:

  <!-- 
  <PageMap> 
     <DataObject type="document"> 
        <Attribute name="title">The Biomechanics of a Badminton Smash</Attribute> 
        <Attribute name="author">Avelino T. Lim</Attribute> 
        <Attribute name="description">The smash is the most explosive and aggressive stroke in Badminton.  
                                      Elite athletes can generate shuttlecock velocities of up to 370 km/h.  
                                      To perform the stroke, one must understand the biomechanics involved,  
                                      from the body positioning to the wrist flexion. </Attribute>                                       
        <Attribute name="page_count">25</Attribute> 
        <Attribute name="rating">4.5</Attribute> 
        <Attribute name="last_update">05/05/2009</Attribute> 
        <Attribute name="thumbnail">http://www.example.com/papers/sic.png" width="627" height="167" /> 
     </DataObject> 
  </PageMap> 
  -->  

如果您绝对必须使用META代码,则Bing Search API会支持索引其NAME属性以“搜索”开头的所有元标记,例如

<meta name="Search.MyCustomProp" content="Hola mi amigo Google, I want my META!">

然后在Bing Results API中,您可以使用WebResult.SearchTag property提取所有这些值。发出请求时,您需要WebRequest.SearchTags Property,或者只需在搜索查询中添加文字,例如poodle meta:search.MyCustomProp(amigo)在search.MyCustomProp元标记包含单词“amigo”的网页上搜索“poodle”一词。只要您每秒保持7次以下查询并遵守其他一些详细here限制,就可以免费使用Bing API。

很抱歉在谈论Bing之前,可以随意忽略这一部分 - 但我在之前的工作中使用Bing API已经有了相当积极的经验。

答案 1 :(得分:0)

您能否详细了解您要使用的元标记。您可以添加元标记,这对Google来说无关紧要。