par
Manuchap
Locomotive 4.x
Cette action à été proposée par 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 %}