How to display only products in search results in Dawn theme

Hello, I am using the shopify’s free Dawn theme at the moment and I sell printed merchandise on my store but I also have several pages and articles for SEO purposes.

Whenever I search a term on my search bar from home on the website, the results are not just products but also blogs and pages that contains the search term. This looks extremely untidy and irrelevant (check screenshot where the first 3 results are pages before the 1st product is displayed on searching “t shirt” from the home page search bar)

I want to just display the products in search results, pages and blogs have their own navigation menu that shouldn’t appear in search results.

Can anyone help me with this? I searched on Google and scrolled through many articles where I found a single line code to block the pages and articles but there is no clear indication of where to exactly put that code. When I paste it into search.liquid file, I just can’t get rid of my problem. Any help and suggestions will be much appreciated. Thank you.

I’ve been trying to find a solution to this issue as well. Please let me know if you’re able to fix it.

Hi @Nishant24 ,

Please follow the steps below:

  • Step 1: Go to header.liquid file, find ‘routes.search_url’ and add code here:

  • Step 2: Go to main-search.liquid file, find ‘routes.search_url’ and add code here:

Code:


Refer: https://shopify.dev/themes/navigation-search/search#the-search-form

Hope it helps!

3 Likes

Hi @LitExtension , it has worked on my desktop view, but on my mobile it’s still having the same problem. Is there a problem?

Hello @LitExtension , thank you so very much for solving this query for me. Now there are no issues in the delivery of search results.

1 Like

It worked for me, Thank you!