TGV: Train with Great Velocity ACTION

Search

by Manuchap
Locomotive 4.x

This action was proposed by Luke Grayson@greyskin on Gitter.

{% action 'search' %}
query = { $or: [
{ title: { $regex: searchphrase, $options: 'i' } },
{ teaser: { $regex: searchphrase, $options: 'i' } },
{ body: { $regex: searchphrase, $options: 'i' } }
]};
setProp('query', query);
{% endaction %}

{% with_scope query %}
{% assign results = contents.posts.all %}
{% endwith_scope %}

{% for post in results %}
// here you can do stuff like {{ post.category }}, where category is a related content_type
{% endfor %}

  Back to the list
X

Signup


X

Sign-in