OpenSearch standard using Movable Type

OpenSearch is a search plugin technology building on RSS to allow content providers to enable searches from a multitude of sites from a common search protocol. You too can have an OpenSearch column using your Movable Type weblog and some small configuration tweaks. I will walk you through the necessary steps to create an OpenSearch channel for your Movable Type weblog. This hack is for advanced users who are comfortable editing their Movable Type configuration file. You break it, you fix it.

Create a new search template

First you need to create a new search template. Create a new text file named osrss.tmpl containing the text below or copy from this text file.

<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<rss version="2.0" xmlns:openSearch="">
<title><$MTBlogName remove_html="1" encode_xml="1"$> results for <$MTSearchString$></title>
<link><$MTBlogURL remove_html="1" encode_xml="1"$></link>
<description><$MTBlogDescription remove_html="1" encode_xml="1"$></description>
<managingEditor><MTEntries lastn="1"><$MTEntryAuthorEmail$></MTEntries></managingEditor>
<webMaster><MTEntries lastn="1"><$MTEntryAuthorEmail$></MTEntries></webMaster>
<pubDate><$MTDate format="%a, %d %b %Y %H:%M:%S "$><$MTBlogTimezone no_colon="1"$></pubDate>
<generator>Movable Type <$MTVersion$></generator>
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link><$MTEntryLink encode_xml="1"$></link>
<description><$MTEntryExcerpt encode_xml="1"$></description>
<pubDate><$MTEntryDate format="%a, %d %b %Y %H:%M:%S "$><$MTBlogTimezone no_colon="1"$></pubDate>
<guid isPermaLink="true"><$MTEntryLink encode_xml="1"$></guid>
<author><$MTEntryAuthorEmail$> (<$MTEntryAuthor$>)</author>
<MTIfNonEmpty tag="MTEntryCategory">
<category domain="<$MTBlogArchiveURL$>">
<MTParentCategories glue="/"><MTCategoryLabel dirify="1" encode_xml="1"></MTParentCategories>

Next you will need to upload this search template to your search_templates directory inside your Movable Type installation.

Edit your Movable Type configuration file

Open mt.cfg in the root directory of your Movable Type installation. Find your alternative template section of your configuration file — search for AltTemplate — and add the line below.

AltTemplate osrss osrss.tmpl

Save your configuration file and exit.

Create your OpenSource description

Next you need to create a special XML to describe your search channel to Amazon. Follow the sample markup for the OpenSource description format and create your own description file. You can take a look at my OpenSearch description document for guidance. Upload your completed file to your weblog’s root directory.

You need to use a special URL in the descriptor to call the results of your newly created template.

<Url>PATH TO MT/mt-search.cgi?IncludeBlogs=WEBLOG ID&amp;SearchElement=entries&amp;SearchCutoff=9999999&amp;Template=osrss&amp;search={searchTerms}</Url>

Please note that you must escape the ampersands.

Description of variables
The location of your Movable Type installation.
The numeric value corresponding to the weblog against which you would like to conduct a search.
Enter entries to search just weblog entries, comments to search just comments, or both to search both entries and comments.
Restrict your search to a number of days in the past. Setting this value to a very large number will allow a search of all your designated content.

Submit your search

That’s it! Submit your OpenSearch search to Amazon and run a test query to make sure you set everything up correctly.


Commentary on "OpenSearch standard using Movable Type":

  1. Anil on wrote:

    Wow, you’re quick! We’ve had a working version of this search template going here at Etech to show people but hadn’t posted it yet. Thanks for sharing the template with everyone.

  2. dewitt on wrote:

    You guys are amazing. Great job, Niall — and it sounds like Anil was headed in the same direction.

    I have to say that I’ve been blown away by the community response to OpenSearch. If anyone has any questions or wants to talk about it, feel free to contact me at

    Cheers, -DeWitt

  3. Marcelo Torres on wrote:

    Hello i’m marcelo and i get a question about mt templates. Where is the search templates in movable type. I want to modify this with my picture. If you can help me, i’ll be so much happy.
    okey bye

  4. Jay Allen on wrote:

    Hey Niall, I just noticed that you have MTEntryAuthorEmail in the template above. In 3.16 and 3.2 we removed email addresses from all of the feeds so as not to feed the spambots. Might want to think about doing the same.

    Take care.

  5. Jay Allen on wrote:

    Marcelo, your search template can be found at MT_DIR/search_templates/default.tmpl unless you’ve specified otherwise in your mt-config.cgi (or mt.cfg before MT 3.2)