Firefox Search Plugin Template for a Movable Type Weblog

·

This (inspired by the Mycroft Search Plugin Generator for Wordpress) makes a Firefox/Mycroft Search Plugin that contains within itself a link to install it, for searching the weblog that produced it. It also uses an ico-to-png converter script on my server that makes it easier to produce the image for the plugin, if you already have a favicon online.

  • In Movable Type's Template Menu, create a new index template and call it 'Mycroft Search Plugin'.
  • Check 'Rebuild this template automatically when rebuilding index templates'.
  • Paste in the following template code. Where it says 'yourblog' at the beginning, change that to the name of your weblog. The variable should have no spaces, as it will be the filename (eg mine is 'hublog').
    
    <$MTSetVar name="filename" value="yourblog"$>
    <search
        name="<$MTBlogName remove_html="1" encode_xml="1"$>"
        action="<$MTCGIPath$><$MTSearchScript$>"
        queryCharset="UTF-8"
        method="GET" >
    <input name="search" user >
    <input name="IncludeBlogs" value="<$MTBlogID$>">
    </search>
    <a href="javascript:window.sidebar.addSearchEngine('<$MTBlogURL$><$MTGetVar name="filename"$>.src', 'http://alf.hubmed.org/ico2png?icourl='+encodeURIComponent('<$MTBlogURL$>favicon.ico')+'&name=/<$MTGetVar name="filename"$>.png', '<$MTBlogName remove_html="1" encode_xml="1"$>', 'Weblogs');">Install</a>
    
  • Set the 'Output File' to be 'yourblog.src' (without the single quotes), using the same filename as above (eg mine is 'hublog.src').
  • Press 'Save', then 'Rebuild This Template'.
  • Add
    AddType text/html .src
    to Apache's configuration and restart Apache. You can probably put this in a .htaccess file instead, but I haven't tested that.
  • Make sure you've got a favicon called favicon.ico in the root directory of your weblog (eg mine is at 'http://hublog.hubmed.org/favicon.ico').

Now open the generated file in Firefox - it should look like this: http://hublog.hubmed.org/hublog.src
Ignore the form fields - just click the Install link and a dialog box should pop up. Press OK and a search plugin for your weblog should be installed.