{% search %}

Use this tag to search the site for pages matching the given search term and return a collection of pages.

Syntax

{% search [[var|set|assign] new_variable_name] [output_to_template] search_term [type:type] [start:1] [page:1] [limit:25] %}

You MUST include either a variable name to assign the collection to, "output_to_template", or both (if both output_to_template should be the later argument).

If you are assigning the collection to a variable and do not specify one of "var", "set", or "assign", then the "var" behavior will be used - which is to save the result on the current scope. If new_variable_name starts with '&', will attempt to assign the value by reference.

If you are outputting the collection to the template, it will use the default output for page_collections

Pagination

This collection can be paginated by providing the following filters:

Number limit
The maximum number of items to included in the collection.
Number start
The 1-based index of the first item to include in the collection.
Number page
If start is not set, automatically set it based on the page number and the limit.

Examples

Search only blog post entities by a query parameter

Copy
{% search output_to_template request.query_params.q type:blog_post %}

Search with query parameters and limit result length

Copy
{% var page = request.query_params.p | default:1 %} {% var limit = request.query_params.l | default:25 %} {% search set results request.query_params.q page:page limit:limit %}