1

I have some pages that I want to exclude from search results. How can I do this?

1

If you mean entire sections you could define which sections you want to display like this:

{% set query = craft.request.getParam('q') %}
{% set entries = craft.entries.craft.entries.section('section1, section2, section3').search(query).order('score') %}
|improve this answer|||||
1

One way would be to create an array of ids to exclude and then use the not filter:

{% set query = craft.request.getParam('q') %}
{% set idsToExclude = [14,15] %}
{% set idsToExcludeString = idsToExclude|join(', not ') %}
{% set entries = craft.entries.search(query).order('score').id('and, not ' ~ idsToExcludeString) %}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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