How to Create an Autodiscovery Blog Search for Web Browser
Have you add LiewCF blog search to your web browser? Many readers are excited by the feature. I will show you how to create an auto discovery blog search for web browsers. WordPress used in this example.
Add LiewCF blog search to your web browser (FireFox 2 in this example)
Table of Contents
The OpenSearch technology
We are using OpenSearch technology for the auto discovery blog search. OpenSearch is a collection of simple formats for the sharing of search results. Currently, both Internet Explorer 7 and Firefox 2 support this feature. Please refer to OpenSearch.org for technical documents.
Overview
It is easy to create an autodiscovery search for web browsers. We need to create a simple xml file and add a line of code into your web page’s header. That’s all. Read on for details.
Note: This tutorial is for WordPRess blog. You might need to modify the code to work with your blogging platform.
Creating OpenSearch XML file
Now, we create a XML file which would be read and added into user’s web browsers.
- Create a new plain text file
- Paste the following lines of code into it:
[xml]< ?xml version="1.0"?>
[/xml]
YOUR_BLOG_NAME
YOUR_BLOG_DESCRIPTION
YOUR_BLOG_LONG_NAME
- Replace these terms in the code with yours:
- YOUR_BLOG_NAME — the name of your blog
- YOUR_BLOG_DESCRIPTION — tell people about your blog
- YOUR_BLOG/PATH — your blog path
- YOUR_BLOG_LONG_NAME — a longer blog name
- Save the file as “myopensearch.xml”
- Upload “myopensearch.xml” to your WordPress blog root.
Blog search auto discovery
In order to make web browsers auto discover our blog search, we need to add a <link/> tag into page header.
- Open “header.php” of your WordPress theme.
- Find: [html]” />[html]
- Add the following line of code immediately after the above line:
[html][/html] - So, it will look like this:
[html]” /> [/html] - Save “header.php” and upload back to your WordPress theme folder.
You’re done! Back to your blog and add the blog search to your web browser. :)
References: Heath Stewart’s Blog and Mozilla Developer Center
Bonus: WordPress OpenSearch plugin — add OpenSearch RSS feed functionality to a WordPress blog. (Does not include browser AutoDiscovery)