opensearch_启用OpenSearch的博客

opensearch

opensearch

Have you noticed when you visit some sites, there's a bluish glow in the search engine field in Firefox. Like this:

当您访问某些网站时,是否注意到了,Firefox的搜索引擎字段中发出蓝色的光芒。 像这样:

open search example firefox

What does that even mean? Well, it means you can add this site's search to the drop down list of search engines. This functionality is following the open search standard.

那有什么意思? 好吧,这意味着您可以将本网站的搜索添加到搜索引擎的下拉列表中。 此功能遵循开放式搜索标准

The things are actually pretty simple. You need to have an XML file <link>-ed to from your page.

事情实际上很简单。 您需要从页面上将XML文件<link> -ed链接到。

For example on this blog I have this in the head:

例如,在此博客中,我的头是这样的:

<link 
  rel="search" 
  type="application/opensearchdescription+xml" 
  href="http://www.phpied.com/wp-content/plugins/open-search/open-search-xml.php" 
  title="phpied.com : Search in posts"
/>

So how do you add open search capability to your blog? With the OpenSearch plugin for WordPress, naturally.

那么,如何为博客添加开放搜索功能? 自然地,使用适用于WordPress的OpenSearch插件。

BTW, if you're running PHP4 you might get errors during installation, in this case just open up the open-search-class.php and

顺便说一句,如果您正在运行PHP4,则在安装过程中可能会出错,在这种情况下,只需打开open-search-class.php并

  • replace all "public static" with empty string

    用空字符串替换所有“公共静态”
  • replace all "private static" with empty string

    用空字符串替换所有“专用静态”
  • replace all "self::" with "OpenSearch::"

    用“ OpenSearch ::”替换所有“ self ::”

This is it, enjoy and if you want to change the default icon, you need to look into replacing the image found in /wp-content/plugins/open-search/default-favicon.png

就是这样,请尽情享受,如果您想更改默认图标,则需要研究替换在/wp-content/plugins/open-search/default-favicon.png找到的图像

Here's what you get at the end:

这是最后的结果:

And now your readers can add your search to their browser and quickly find content on your blog. Sweet.

现在,您的读者可以将搜索添加到他们的浏览器中,并快速在博客上查找内容。 甜。

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/opensearch-enabling-your-blog/

opensearch

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值