Search your weblog with Mozilla

These instructions are mainly for Movable Type users, but I have noted the changes necessary for other systems. Tony Williams is using Perlfect Search with Blosxom, as he wrote to the Blosxom list earlier today; as he's using static mode, it sounds like any weblog tool that bakes your pages will work. If you want search for your Radio UserLand weblog and can't set up Perlfect, these PicoSearch instructions by Russ Lipton still apply as far as I know.

If any of the below is unclear, my markpasc.src is here.

  1. Copy this file to your Mozilla searchplugins directory. Name it weblog.src, or some other name.src. (I use markpasc.src.) Open the file in your favorite text editor.
  2. Replace the name, description, action, and searchForm attributes with the appropriate values for your weblog. Because Movable Type will display a helpful search page, MT users can use the same URL in both; otherwise, action is the URL that receives the form data, and searchForm is where you would send a web user to enter a query.
  3. To limit your search to certain Movable Type weblogs, remove the !-- and -- from the IncludeBlogs tag, and set the value appropriately. Separate multiple values with a comma (eg, <input name="IncludeBlogs" value="2,3">). If you're using some other search tool and need to specify other standard options, set them in input tags like the IncludeBlogs one (that is, with value attributes).
  4. If you want your plugin to work in the Mozilla sidebar (which isn't so important for me as I'm using Phoenix), you have to set up your interpret tag. If you don't do anything, Mozilla will just list every off-site link in the search results, which is rather ugly if you show full entries in your results like I do.
    1. Uncomment the interpret tag.
    2. Look at your search template, or do a test search and look at the resulting HTML. Is it clear where your results begin and end? If so, put these strings in as the resultListStart and resultListEnd attributes. If not (and you're using Movable Type or some other system where you have this control), make something up--HTML comments like <!-- results --> and <!-- /results --> would be good--and add them to both your search plugin as resultListStart and resultListEnd and to your search template. (In Movable Type, flank your MTSearchResults tag with them.)
    3. Look at your template or example search again. Find the starting and ending codes for your entry titles. Is it obvious where your title is? It is if you're using proper semantically-charged HTML. My titles are h3s with id attributes, so it's easy for me: <h3 id= and </h3>. If it isn't so easy, you can add comments as above.

      I tried to use class="title" at first, but had to escape the double quotes as &quot;, and Mozilla didn't seem to catch what I meant. If you need to use double quotes in any of these result attributes, try putting the attribute in single quotes instead of double quotes. If you need both, you may need to break down and add an HTML comment as above.

      The search plugin needs to find not only your title, but a complete a href, so make sure your title is a link. You can use CSS to make it not look as link-like; I like my title links to be the same color as the text, and only have an underline when moused over. The CSS rules for that would be:

      h3 a:link { color: black; text-decoration: none; }
      h3 a:hover { color: black; text-decoration: underline; }

      with h3 and black replaced with whatever's appropriate for your template, of course.

  5. If you want to spiff it up in your UI, provide an icon. Make it 16×16 pixels and put it in the Mozilla/searchplugins directory with the same filename as your .src file, but its regular .gif or .png extension. (Hint, if your weblog doesn't have a logo, like mine: the little gear in the Movable Type logo is 14×15 pixels.)
  6. Restart Mozilla and enjoy.
  7. If you're providing your search plugin to others and want to keep it updatable, uncomment the browser tag as above. Upload your .src file and icon somewhere public, and put their URLs in the update and updateIcon attributes of the browser tag.
  8. Look at the Mycroft documentation for a few more embellishments.

TrackBack

Listed below are links to weblogs that reference Search your weblog with Mozilla:

» Reading List from Kaffeesud
Some links for today: Search your weblog with Mozilla: markpasc.org Searching bogs U.S., Britain put off Iraqi self-rule Debate on economics of pay-to-read independent journalism... [Read More]

» Monkey Search from Mozilla Firebird from Ramblings of a Code Monkey
Thanks to asa and Mark Pasc, I now have a Mozilla Firebird search plugin available for . It adds an extra option to the search combo box on your toolbar (the one where you can search Google and the current... [Read More]

» Search tricks from Distractions
I find myself quite often going to my weblog to search for something I vaguely remember blogging, and such... [Read More]