Not a developer? Go to



A container tag whose contents are displayed only if there is no search performed. This tag is only recognized in search templates.

Version History

There’s a problem with this tag in version 4.2: bug 81304. The NoSearch tag is not functional and is fixed in 4.21.

Meanwhile, you can actually use the <mt:If>, <mt:Else>, <mt:ElseIf> and <mt:Unless> conditional tags to get this to work. Basically, you run <mt:If> to test whether the search string evaluates to an empty string, i.e., whether it has a single alphanumeric character in it.


<mt:if tag="searchstring" like="/\w/">
                <h2>Results for: <mt:searchstring></h2>
                <h2>Search Results for: <mt:searchstring></h2>
                <b><a href="<MT:EntryPermalink>" title="<MT:EntryTitle>"><mt:EntryTitle></a></b><br />
                <mt:Entrybody />

        <h2>Searched for <mt:searchstring></h2>
        <p>No entries were found containing <mt:searchstring></p>


        <h2>Nothing to search!</h2>
        <p>You didn't say what you're looking for. Perhaps you need to find yourself first?</p>


<mt:if tag="searchresultcount" eq="0">
    <p>By default, this search engine looks for all words in any order. To search for an exact phrase, enclose the phrase in quotes:</p>

        "<code>movable type</code>"

    <p>The search engine also supports <code><b>AND</b></code>, <code><b>OR</b></code>, and <code><b>NOT</b></code> keywords to specify boolean expressions:</p>

        <code>publishing <b>OR</b> personal</code>

        <code>publishing <b>NOT</b> dynamic</code>

The logic is this:

  1. If the search string has some term in it, then:
    a. show the results if any are found; or
    b. show no results found for that string;
  2. If the search string does not have a search term at all (the string is empty), fire the <mt:NoSearch> code chunk.

Finally, if <mt:SearchResultCount> evaluates to zero (there are no search results; which is true whenever nothing is found and also when nothing is specified to find), display instructions.


Leave a Comment