noindex header code: if original url contains then noindex

noindex header code: if original url contains then noindex

deakon
Explorer
58 5 6

we need to noindex pages which contain a specific phrase in the url.   

 

{% if url contains 'page=' %} <meta name="robots" content="noindex"> {% endif %}

{% if url contains 'login_to_shop' %} <meta name="robots" content="noindex"> {% endif %}

 

i know that shopify creates canonicals for the 'page=' pages directing to the main (non-paginated) url.

however, per google search results and google search console, many of our paginated pages are being indexed causing possible duplicate pages to be indexed.   

 

we have tried "if request.path contains"  

we've tried "if page.url contains"   

 

sample url:

https://www.finishlinewheels.com/collections/honda-factory-wheels?page=3

even with the canonical these are still getting indexed.   

 

thanks for your help, will give good review to accepted.   

Replies 0 (0)