I want to remove blogs from my search results

Hi,

When I search for any product on my website. It shows the blogs also related to that keyword. So, I just want to show products not blogs on search results.

Website - http://tanzire.co/

This is my current code on search.liquid

{% paginate search.results by 12 %}

  {% if search.performed == false %}
    

      # {{ 'general.search.title' | t }}
  {% else %}
    
      # 
        {{ 'general.search.heading' | t: count: search.results_count }}:
        {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}
      
  {% endif %}
      
        

          
        

      

      {% if search.performed and search.results_count == 0 %}
        

---

        
          

{{ 'general.search.no_results_html' | t: link: routes.root_url }}

        

      {% endif %}
  

{% if search.performed %}
  {% if search.results_count > 0 %}
    

---

  {% endif %}
  ## {{ 'general.search.heading' | t: count: search.results_count }}
  
    {% for item in search.results %}
      - {% if item.object_type == 'product' %}
              {% include 'product-card-grid', product: item %}
            {% else %}
            

              
                  {{ item.title }}
              
              

                  {% if item.image %}
                  

                    

                      
                    

                  

                  {% endif %}
                
                  

                      {{ item.title }}
                  

                  
                      {% if item.published_at %}{{ item.published_at | date: format: "date" }} — {% endif %}
                      {{ item.content | strip_html | truncate: 200 }}
                  

                

              

            

            {% endif %}
      
    {% endfor %}
  

  {% if paginate.pages > 1 %}
    {% include 'pagination' %}
  {% endif %}
{% endif %}
{% endpaginate %}

Hi @tanzire

This seems to depend on SEO, not code. To fix this issue, I would like to recommend 2 methods below:

  1. Add some more high-quality backlinks to your product URL, link your blog URL to the related product URL that you want to rank in SERPs.
  2. Set your blog URL noindex and remove it in GSC. If your blog URL got some backlinks and traffic, you should redirect the URL to the product page (with 301 redirect). If you do not know how to create an URL redirect, this guide: 6 Steps to Create an URL Redirect on Shopify would be useful for you.

Hope it helps!

Hi @tanzire ,

This is my recommendation for your issue. On Search result page if you just want to show the products only. You need remove this snippet:

{{ item.title }}

{% if item.image %}

{{ item.image.alt | escape }}

{% endif %}

{{ item.title }}

{% if item.published_at %}{{ item.published_at | date: format: “date” }} — {% endif %}

{{ item.content | strip_html | truncate: 200 }}

Please take a look at our screenshot here: https://prnt.sc/10i5xwn

Hope this helps!

I was able to remove the blogs from showing up in search by removing the below code on Simple theme via Search.liquid inside the templates folder:

{% else %}

{{ item.title | link_to: item.url }}

{{ item.content | strip_html | truncatewords: 50 }}

So under the {% if search.performed %} it will be

{% for item in search.results %}

{% if item.object_type == ‘product’ %}

{% assign product = item %}
{% include ‘product-grid-item’ %}

{% endif %}

{% endfor %}