我正计划实施一个谷歌网站搜索(并为此付费,以便我可以访问 XML)。我想知道的一件事是在其中使用自定义元标记的可能性。
我从同事那里听说是的,但没有得到证实。寻找答案没有给出任何结果(也许是因为你不能?)
有人知道吗?
编辑:我希望能够从搜索结果中检索这些元标记,以便能够为不同类型的页面提供不同的样式。
我正计划实施一个谷歌网站搜索(并为此付费,以便我可以访问 XML)。我想知道的一件事是在其中使用自定义元标记的可能性。
我从同事那里听说是的,但没有得到证实。寻找答案没有给出任何结果(也许是因为你不能?)
有人知道吗?
编辑:我希望能够从搜索结果中检索这些元标记,以便能够为不同类型的页面提供不同的样式。
是的,你可以做到这一点,但据我所知,不能使用元标记。相反,google 允许您将自定义属性放入 HTML 中,然后可以从您从 Google 自定义搜索结果 API 返回的 XML 中检索这些属性。
查看 http://code.google.com/apis/customsearch/docs/snippets.html以了解有关其工作原理的更多信息。结构化数据部分概述了您可以将自定义元数据粘贴到页面中的具体方法,以便 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 结果 API 中,您可以使用WebResult.SearchTag property
. 发出请求时,您需要WebRequest.SearchTags Property
或者您可以只在搜索查询中添加文本,例如poodle meta:search.MyCustomProp(amigo)
在 search.MyCustomProp 元标记包含单词“amigo”的页面上搜索单词“poodle”。使用 Bing API 是免费的,只要您保持在每秒 7 个查询以下并遵守此处详述的其他一些限制。
很抱歉谈论了这么多关于 Bing 的内容,请随意忽略这部分——但我在之前的工作中使用 Bing API 有过相当积极的经验。
您能否详细说明您要使用的元标记。您可以添加元标记,这对 Google 来说并不重要。