通过Google Custom Search打造精彩站内搜索
Author: admin
大家都知道通过Google Ajax Search Api接口,能引用Google搜索功能,打造自己的站内搜索,但自己实在是不知道API是啥东西,而且对Ajax也一无所知,要怎么办呢?下面我介绍一种白痴化的方法通过Google Custom Search同样达到Google站内搜索。
首先来到Google Custom Search页面申请属于你自己的Custom Search.

直接点击图中的”Creat a Search Engine”开始申请。

按照提示输入一些基本信息,在”Site to search”选项框里输入你的站点,注意去掉下面”Alaso include all site
linked to from these pages”的选钩,如果选中这项的话,它同样会从连接到你站点的页面里面搜索,当然你如果想这样的话,你可以选中这项。
完成申请后,点击左侧的”My search engines”,这时你就会看到你刚刚申请的Custom search,点击选项中的”control panel”,来到控制面板,点击导航中的”code”来获取代码。

点击下面的”Search box and search results code for you website”,在”Specify the URL of the page on your site where you want to the search results to appear”选项框输入你想要显示搜索结果的页面。往下面看,你会发现有两段代码。上面的代码时显示搜索框的,你可以把它放到你页面任何想显示搜索框的位置。而下面的一段代码是要放置到你显示搜索结果页面中的,也就你你刚刚指定的”Specify the URL of the page on your site where you want to the search results to appear”页面当中,如果是Wordpress的话,可以直接创建一个页面,把代码输入其中,然后把搜索结果显示的页面直接指定到刚刚创建的页面就行,至此一个完美的Google Custom Search站内搜索完成,实例可以直接适用下本站点头部或侧边栏的搜索功能!
http://housne.info/notes/google-custom-search/
http://housne.info/wordpress/simple-housne/
http://www.bbon.cn/2008/12/wordpress-bbtheme-cms.html
http://www.bbon.cn/2008/12/wordpress-bbtheme-cms-final.html
http://wordpress.org.cn/thread-30282-1-1.html
http://www.th7.cn/Article/wy/cms/200808/324650.html
Tags: 搜索
Comments are closed.