1

I'm trying to figure out how to exclude a Channel, Structure or Singles from my search results.

Currently I have the default example from Craft

{% set query = craft.request.getParam('q') %}
{% set entries = craft.entries.search(query).order('score') %}
| improve this question | | | | |
8

This should work for a single section:

{% set entries = craft.entries.section('not news').search(query).order('score') %}

to exclude more sections:

{% set entries = craft.entries.section([
    'and', 'not news', 'not blog'
]).search(query).order('score') %}
| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.