Hi!
I would like to block some specific URLs from my being indexed by Google so I added the following code to the of the theme.liquid folder I wanted to make sure that the code below was correct.
-
As you have noticed, I am using the “if url contains” argument instead of the “if handle contains” argument. Will Google still recognize this?
-
For some background I’m afraid that if I use the “If handle contains” argument, then I will no index all pages that have that keyword in the handle at all.
-
So for example I have one page that has the handle “mens” and if I wrote {% if handle contains ‘mens’ %}
Then wouldn’t that no-index all of the following pages? /mens, /mens-vitamin, /collection/mens, /pages/mens, etc.?
Here’s the code
{% if url contains ‘/pages/prenatalvitamins’ %}
{% elsif url contains ‘/pages/fertility’ %}
{% elsif url contains ‘/pages/sperm’ %}
{% elsif url contains ‘/collections/men’ %}
{% elsif url contains ‘/collections/women’ %}
{% elsif url contains ‘/collections/frontpage’ %}
{% elsif url contains ‘/collections/beli-collection’ %}
{% else %}
{% endif %}
thank you
Loren