Search Tag

This is how you do search. This is the tag you're looking for.


An overview on how to configure search, indexing, and the query form can be found in the Search Docs.


On a search result page, you can loop through the results of the search like they were entries. You’ll have access to all the data of all the content of your search results returned so you can format them any way you wish.

{{ search:results }}

  {{ if no_results }}
    <h2>No results.</h2>
  {{ else }}

    <a href="{{ url }}" class="result">
      <h2>{{ title }}</h2>
      <p>{{ content | truncate:240 }}</p>

  {{ /if }}

{{ /search:results }}

Search Forms

The search form itself — that text box users type into, is a normal, every day HTML form with a search input that submits to a URL containing a search:results tag in the template. Nice and simple.

<form action="/search/results">
    <input type="search" name="q" placeholder="Search">
    <button type="submit">Make it so!</button>

Supplementing Data

By default, data will be supplemented. This means that while your search indexes can remain lean by only including the fields you actually want to be searchable, the tag will convert your results into full objects (entries, terms, etc.) which allow you to use any of their fields.

There is an overhead associated with this though, so if all you need is to display values that are in the index, you may disable supplementing.

{{ search:results supplement_data="false" }}

This has a few caveats:

  • Only fields that you’ve indexed will be available.
  • The search tag will filter out any unpublished items by default. If you haven’t indexed the status field, you will get no results. Either index the status field, or add status:is="" to your tag to prevent the filtering.
  • When using multiple sites, the search tag will filter items for the current site. If you haven’t indexed the site field, you will get no results. Either index the site field, or add site:is="" to your tag to prevent the filtering.


index string

The search index to query. Default: default.

query string

The query string parameter used for the search term. Default: q.

site string

The site you wish to search. If you wish to search in all sites, you can use a wildcard: *. Default: the current site.

limit integer

Limit the total results returned.

offset integer

Skip the first n number of results.

as string

Alias your results into a new variable loop.

supplement_data string

When true will include all non-indexed content field. See supplementing data Default: true.


Variable Type Description



If there are no results.



If this is the first item in the loop.



If this is the last item in the loop.



The number of current iteration in the loop.



The zero-based count of the current iteration in the loop.



The number of results in the loop.



The internal relevance score that Statamic given to this result. Helpful for debugging, but useless to the public. Only applies when using the local driver.



The type of result. e.g. entry, term, asset, etc.



Available when using the Algolia driver. Displays a field with the search term automatically highlighted. Example: {{ _highlightResult:myfield:value }}

Betterify this page on Github!