1

I want to make a search page and it should list entries only in statamic.

My code is

  {{ search:results index="default" }}
    {{ if no_results }}
        <h2>No results found for {{ get:q }}.</h2>
    {{ else }}
        <a href="{{ url }}">
            <h2>{{ title }}</h2>
            <p>{{ description | truncate:180 }}</p>
        </a>
    {{ /if }}
{{ /search:results }}

Result Coming

in this code it loads entries, Taxonomy everything in result

Expected Result

It should load only entries from collection

Note: I have tried using {{entries}} {{/entries}}, but it doesn't worked

Naveen Nayak
  • 175
  • 1
  • 1
  • 11

1 Answers1

1

My guess is that in your Statamic search config (config/statamic/search.php), you had it indexing everything.

In that config file, you can set it so only things you specify are indexed. For example, you could only choose to let entries be indexed:

'searchables' => ['collection:blog', 'collection:news'],

After that, run this command to re-index Statamic's Search Index: php please search:update and you should be good to go!

For more information around Searchables in Statamic, view the documentation.

Duncan McClean
  • 130
  • 2
  • 11