No index tags for URl Parameters

Tourist
5 0 1

Hi,

I am not expert and wanted some feedback on this code that I just implemented into my theme header for no indexing url parameters. Is this a good or not?

  <!-- No Index Collection Parameters -->
  
  {% if template contains 'collection' and current_tags %}
  <meta name="robots" content="noindex" />
  {% endif %}
  {% if template contains 'collection' and collection.handle == '?sort_by=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  {% if template contains 'collection' and collection.handle == '?variant=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  {% if template contains 'collection' and collection.handle == '?view=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  {% if template contains 'collection' and collection.handle == 'types?q=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  {% if template contains 'collection' and collection.handle == 'types?constraint=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  {% if template contains 'collection' and collection.handle == '?lshst=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  
  <!-- No Index Product Parameters -->
  
  {% if template contains 'product' and product.handle == '?variant=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}
  {% if template contains 'product' and product.handle == '?view=' %}
  <meta name ="robots" content="noindex"/>
  {% endif %}

 

Jennifer Myers www.articleandthread.com
1 Like
New Member
1 0 0

ça ne fonctionne pas chez moi avec le thème début

0 Likes
New Member
2 0 0

Hi Jennifer,

 

Your code won't work because the {{ collection.handle }} won't output the url parameters. I've been looking for a way to do this with liquid code but haven't found a good solution.

0 Likes