--- url: https://docs.youcan.shop/themes/templates/template-types/search.md --- # search The `search` template handles the rendering of the search results page, displaying products and content that match a customer's query. ## Location The `search` template is located in the `templates` directory of the theme. ```bash └── theme ├── layout ├── templates │ ... │ ├── search.json │ ... ... ``` ## Usage The `search` template receives no data object. Results are fetched by paginating the special `search.products` collection, which reads the query string of the `/search` request (`q`, `sort_field`, `sort_order`, `filters[]`). ```liquid {% paginate search.products by 24 cod %}

{{ total }} results for "{{ terms }}"

{% for product in items %} {% endfor %} {% endpaginate %} ``` `items` holds the matching [product objects](/themes/objects/product) for the current page. See the [paginate tag](/themes/tags/paginate#paginate) for the other variables exposed inside the block (`total`, `current`, `next_page`, and so on). `terms` is exclusive to `search.products` — it holds the submitted search query (`?q=`). ### Search form The search form only needs to `GET` `/search` with a `q` input: ```liquid
```