如何让Google检测到网站搜索引擎?

编程入门 行业动态 更新时间:2024-10-09 04:16:59
本文介绍了如何让Google检测到网站搜索引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 Google Chrome有一个功能,您可以点击标签来搜索网站。 Chrome然后导航到网站自己的搜索引擎并运行输入的查询。 Chrome浏览器文档表明,只有谷歌在您尝试搜索的网站上检测到搜索引擎时才可以使用。

这的确如此,因为编写 stackoverflow<标签>测试< Enter> 使Chrome浏览此处 facebook< Tab> test< Enter> 不会执行任何操作,因为tab-key标签不在地址栏中。

我想知道的是,如何向Google表明我的网站有一个搜索引擎,以及Google如何利用格式化查询来正确地将Chrome用户重定向到我的网站,当使用Tab键搜索功能时。它是一个Meta标签吗?它是在robots.txt?

解决方案

经过一点挖掘,我发现这个描述这个的页面。您还可以阅读Stackoverflow的源代码并找到以下代码行:

< link rel =searchtype = application / opensearchdescription + xmltitle =Stack Overflowhref =/ opensearch.xml>

它的作用是向Google表明如何在文件 /opensearch.xml 其中包含:

<?xml version = 1.0encoding =UTF-8?> < OpenSearchDescription xmlns =a9/-/spec/opensearch/1.1/xmlns:moz =www.mozilla/2006/browser/search/> ; < ShortName>堆栈溢出< / ShortName> <说明>搜索堆栈溢出:针对专业和爱好者程序员的Q& A< /说明> < InputEncoding> UTF-8< / InputEncoding> < Image width =16height =16type =image / x-icon> http://sstatic/stackoverflow/img/favicon.ico< / Image> < Url type =text / htmlmethod =gettemplate =stackoverflow/search?q={searchTerms}>< / Url> < / OpenSearchDescription>

Google Chrome has a feature where you can hit tab to search a site. Chrome then navigates to the site's own search engine and runs the inputted query. The Chrome documentation indicates that this is only available if Google has detected a search engine on the site you are trying to search.

This indeed seams to be the case, because writing stackoverflow<Tab>test<Enter> makes Chrome navigate here while facebook<Tab>test<Enter> does nothing because the tab-key tabbes out of the address line.

What I'm wondering is then how to indicate to Google that my site has a search engine and how Google needs to format a query in order to redirect a Chrome user correctly to my site when the tab-search feature is utilised. Is it a Meta tag? Is it in robots.txt?

解决方案

After a little digging I found this page that describes this. Also you can read in Stackoverflow's source code and find this line of code:

<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">

What it does is indicate to Google that the description for how to use your search engine in the file /opensearch.xml which contains this:

<?xml version="1.0" encoding="UTF-8" ?> <OpenSearchDescription xmlns="a9/-/spec/opensearch/1.1/" xmlns:moz="www.mozilla/2006/browser/search/"> <ShortName>Stack Overflow</ShortName> <Description>Search Stack Overflow: Q&amp;A for professional and enthusiast programmers</Description> <InputEncoding>UTF-8</InputEncoding> <Image width="16" height="16" type="image/x-icon">sstatic/stackoverflow/img/favicon.ico</Image> <Url type="text/html" method="get" template="stackoverflow/search?q={searchTerms}"></Url> </OpenSearchDescription>

更多推荐

如何让Google检测到网站搜索引擎?

本文发布于:2023-11-01 00:51:18,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:检测到   搜索引擎   网站   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!