我正计划实施谷歌站点搜索(并付费以便我可以访问 XML)。我想知道的一件事是是否可以在其中使用自定义元标记。
我从同事那里听说是的,但没有得到证实。寻找答案没有给出任何结果(也许是因为你不能?)
有人知道吗?
编辑:我希望能够从搜索结果中检索这些元标记,以便能够为不同类型的页面提供不同的样式。
I'm planning on implementing a google site search (and paying for it so I can get access to the XML). One thing I am wondering about is the possibility to use custom meta tags in it.
I've heard yes from colleagues but nothing confirmed. Searching for an answer has given nothing (maybe because you cant?)
Anybody knows?
Edit: I want to be able to retrieve those meta tags from the search result to be able to provide different styling for different types of pages.
发布评论
评论(2)
是的,您可以做到这一点,但据我所知,不能使用元标记。相反,Google 允许您将自定义属性放入 HTML 中,然后可以从 Google 自定义搜索结果 API 返回的 XML 中检索这些属性。
看看
http://code.google.com/apis/customsearch/docs/snippets.html 了解有关其工作原理的更多信息。 结构化数据部分概述了粘贴自定义元数据的具体方法放在您的页面中,以便 Google 会将其与每个搜索结果一起返回给您。最简单的似乎是 PageMap,它是 HEAD 中的 HTML 注释,如下所示:
如果您绝对必须使用 META 标记,则 Bing Search API 支持对 NAME 属性以“Search”开头的所有元标记建立索引。例如,
然后在 Bing Results API 中,您可以使用 < 提取所有这些值a href="http://msdn.microsoft.com/en-us/library/dd250904.aspx" rel="noreferrer">
WebResult.SearchTag 属性
。发出请求时,您需要WebRequest.SearchTags 属性< /code>
或者您可以只在搜索查询中添加文本,例如
poodle meta:search.MyCustomProp(amigo)
在 search.MyCustomProp 元数据所在的页面上搜索单词“poodle”标签包含单词“amigo”。使用 Bing API 是免费的,只要您保持在每秒 7 个查询以下,并遵守一些其他详细限制 此处。很抱歉谈论了这么多关于 Bing 的内容,请随意忽略这一部分——但我在之前的工作中使用 Bing API 获得了相当积极的体验。
Yes, you can do this, although not, as far as I know, using meta tags. Instead, google allows you to put custom attributes inside your HTML, which can then be retrieved from the XML you get back from Google Custom Search results API.
Take a look at
http://code.google.com/apis/customsearch/docs/snippets.html for more info on how this works. The Structured Data section outlines the specific ways you can stick custom metadata inside your page so Google will hand it back to you along with each search result. The easiest seems to be a PageMap, which is an HTML comment inside your HEAD, like this:
If you absolutely must use META tags, the Bing Search API does support indexing all meta tags whose NAME property starts with "Search.", e.g.
Then in the Bing Results API you can pull out all these values using the
WebResult.SearchTag property
. When issuing the request, you'll either need theWebRequest.SearchTags Property
or you can just add text to your search query, e.g.poodle meta:search.MyCustomProp(amigo)
searches for the word "poodle" on pages where the search.MyCustomProp meta tag contains the word "amigo". Using the Bing API is free as long as you stay under 7 queries per second and adhere to some other restrictions detailed here.Sorry to be talking so much about Bing, feel free to ignore that part-- but I have had reasonably positive experiences using the Bing API at a previous job.
您能否详细说明您要使用的元标记。你可以添加元标签,这对谷歌来说应该不重要。
Can you detail more about the meta tags you want to use. You can add meta tags and it should not matter to Google.