The Movable Type Knowledge Base

Limiting Search Results to One Weblog

Question

How can I make sure that the results from a search are limited to entries from one weblog?

Answer

Add a Hidden Form Input

In any template(s) which include a search form for the weblog, add a hidden form input inside the <form> and </form> tags:

<input type="hidden" name="IncludeBlogs" value="<$MTBlogID$>" />

Save and Rebuild the template(s).

Consider an Alternate Search Template

The search form(s) on your weblog(s) will return results using the Default Search Template (located in your Movable Type installation directory at search_templates/default.tmpl). If subsequent searches are performed from that template, they will not be restricted to one weblog as was the original search.

If it's important to you that search results from multiple weblogs be kept separate, you should consider using an Alternate Search Template, which will permit subsequent searches to also be restricted to the weblog from where the first search originated. See Adding Alternate Search Templates in the User Manual for more information.

Tip: Specifying Multiple Weblogs

If you'd like a search form to return results from more than one weblog, add a hidden form input for each of those weblogs, specifying the ID1 for each. For example, to include results from weblog IDs 1 and 2:

<input type="hidden" name="IncludeBlogs" value="1" />
<input type="hidden" name="IncludeBlogs" value="2" />

1 You can determine the ID of a weblog by looking at the URL shown in the address bar of your browser when you are logged into that weblog through Movable Type; look for the blog_id parameter in the URL.

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or questions. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Support.

Yahoo! Small Business web hosting services

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.