Google 网站搜索中的元标记

发布于 2024-08-24 01:18:03 字数 196 浏览 4 评论 0 原文

我正计划实施谷歌站点搜索(并付费以便我可以访问 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉风有信 2024-08-31 01:18:03

是的,您可以做到这一点,但据我所知,不能使用元标记。相反,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 属性以“Search”开头的所有元标记建立索引。例如,

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

然后在 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:

  <!-- 
  <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> 
  -->  

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.

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

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 the WebRequest.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.

白日梦 2024-08-31 01:18:03

您能否详细说明您要使用的元标记。你可以添加元标签,这对谷歌来说应该不重要。

Can you detail more about the meta tags you want to use. You can add meta tags and it should not matter to Google.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文