How can I change the list order on search result?

Jezweb
Excursionist
15 0 0

Hi, 

I want to customize the search result in product->article->page order.

How can I do that? I have tried some ways but it always showed page first.

I am using Debut theme.

Here is my current code in search.liquid

{% for item in search.results %}
{% if item.object_type == 'product'%}
<li class="list-view-item">
{% include 'product-card-list', product: item %}
{% else %}

<div class="product-card product-card--list">
<a href="{{ item.url }}" class="full-width-link">
<span class="visually-hidden">{{ item.title }}</span>
</a>

<div class="list-view-item__link">
<div class="list-view-item__image-column">
<div class="list-view-item__image-wrapper product-card__image-wrapper">
{% unless item.image == null %}
<img class="list-view-item__image" src="{{ item.image.src | img_url: '600x600' }}" alt="{{ item.image.alt | escape }}">
{% endunless %}
</div>
</div>

<div class="list-view-item__title-column">
<div class="list-view-item__title" aria-hidden="true">
<span class="product-card__title">{{ item.title }}</span>
</div>
<div>
{% if item.published_at %}{{ item.published_at | date: format: "date" }} &#8212; {% endif %}
{{ item.content | strip_html | truncate: 200 }}
</div>
</div>
</div>
</div>
{% endif %}
</li>
{% endfor %}

 

If anyone can help would be great, thanks in advance.

0 Likes