How do I know if Robots Tag is Working

Paul_Skirbe
New Member
2 0 0

Hi There,

I want to de-index the tagged pages from the blog to remove duplication issues with my website. To accomplish this, however, I don't know if I've implemented the correct code into the theme.liquid file. Without waiting for the search engines to crawl the page (which could take several days), how can I verify if I've correctly executed the right code? 

Here's what I did:

1) I implemented the following into the theme.liquid within the head section:

{% if template contains '/blogs/discover/tagged/' %}
<meta name="robots" content="noindex">
{% endif %}

2) I saved it. 

3) I refresh a specific tagged page and view the source. 

Each time I check the source, I don't see "<meta name'"robots" content="noindex">.

So am I implementing something incorrectly or should I not expect to see the meta tags in the source code? 

Please advise. 

Thanks,

Paul

0 Likes
Jason
Shopify Expert
10188 137 1918

Your code isn't correct so this can't work:

{% if template contains '/blogs/discover/tagged/' %}
  ...
{% endif %}

template would literally be the name of the template file (so blog, article, page.alternative, etc). It won't contain the url structure like that so the if statement will always return false.

Take a look at blog.tags instead:
https://help.shopify.com/themes/liquid/objects/blog#blog-tags

So consider something more like:

{% if blog.tags.size > 0 %}
  ...
{% endif %}

 

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
Paul_Skirbe
New Member
2 0 0

Thanks Jason. So I implemented your correction, saved it and used the Preview feature to check that the noindex meta tag was rendering, which it was. 

But when I go into a live version of the page (by opening up a new browser tab), I don't see the noindex meta tag on any tagged urls. 

Any ideas on what's wrong now?

 

0 Likes