Searching in Twig

Related Links


You can search entries in Twig just like you normally would using the model. Because of the similarity between the EntryCriteria and the QueryBuilder it wraps it feels very familiar.

Basic Usage

To get started searching entries simply start a query and use the search function:

{% set results = entries('posts', 'categories').search('news').get() %}

Paginating Results

Similarly you can paginate results in Twig the same way:

{% set results = entries('posts', 'categories').search('news').paginate(15) %}

{% foreach result in results %}
{% endforeach %}

{{ results.render()|raw }} {# or alternatively use links() #}