How to Create an Autodiscovery Blog Search for Web Browser

Filed in: Web Development, Weblog, WordPress — October 30th, 2006

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 browser
Add LiewCF blog search to your web browser (FireFox 2 in this example)

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.

  1. Create a new plain text file
  2. Paste the following lines of code into it:
    [xml]

    YOUR_BLOG_NAME
    YOUR_BLOG_DESCRIPTION

    YOUR_BLOG_LONG_NAME
    [/xml]
  3. 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
  4. Save the file as “myopensearch.xml”
  5. 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.

  1. Open “header.php” of your WordPress theme.
  2. Find: [html] [/html]
  3. So, it will look like this:
    [html] [/html]
  4. 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)

Like this post? Please share:

Follow @liewcf on Twitter; Join Facebook page; Subscribe to free newsletter for updates like this article..

  • http://ajaydsouza.com/ Ajay D’Souza

    Thanks for the tutorial Liew. Will be adding the blog search to my blog as well now :)

  • http://ajaydsouza.com/ Ajay D’Souza

    Thanks for the tutorial Liew. Will be adding the blog search to my blog as well now :)

  • http://ajaydsouza.com/ Ajay D’Souza

    Thanks for the tutorial Liew. Will be adding the blog search to my blog as well now :)

  • Pingback: Techtites » Blog Archive » How to Create an Autodiscovery Blog Search for Web Browser

  • Pingback: Adding OpenSearch to your WordPress Blog » Bill2me.com

  • http://HappinessBlog.com/ Michele Moore

    Thanks so much for a great tutorial! I hate to ask a really dumb question, but for those of us who just follow you instructions because we have no idea what we’re doing…

    When I save the file as myopensearch.xml with Note Pad, what encoding do I use? UTF-8, Unicode? Does it make a difference?

    Thanks so much for helping to make Happiness more visible!

  • http://HappinessBlog.com Michele Moore

    Thanks so much for a great tutorial! I hate to ask a really dumb question, but for those of us who just follow you instructions because we have no idea what we’re doing…

    When I save the file as myopensearch.xml with Note Pad, what encoding do I use? UTF-8, Unicode? Does it make a difference?

    Thanks so much for helping to make Happiness more visible!

  • LcF

    @Michhele Moore: UTF-8 or Unicode doesn’t matter because the code is standard alphabet characters.

  • LcF

    @Michhele Moore: UTF-8 or Unicode doesn’t matter because the code is standard alphabet characters.

  • LcF

    @Michhele Moore: UTF-8 or Unicode doesn’t matter because the code is standard alphabet characters.

  • Pingback: AdzP.co.uk

t