How to noindex /en pages without affecting other URLs?

{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% endif %}

Hello everyone,

i currently use a mywebsite.nl as a main domain and want to add a mywebsite.com for a english worldwide version.

now i still want the mywebsite.nl to have a english translation available which will result in a mywebsite.nl/en at the end, this is fine but i want to NOINDEX every page that has /en at the end but only those url’s aswell as /en/collection, /en/products/bracelet etc etc the entire .nl/en version of the website.

i found the code below but my question is if i add ‘en’ to the code below will this noindex all pages with handles that have ‘en’ like /armbanden or /kettingen or is it only pages with /en because i don’t want it to accidently noindex my dutch url’s aswell

Hello @S02K

If you only add ‘en’ to your if clause, then it will indeed also add the noindex tag to handles which contain “armbanden” or “kettingen”. So you would have to be more specific with your handles, ie. adding another character like a dash or underscore to your translated handles. please also be aware that using noindex is merely a “suggestion” for search engines, but you cannot be sure whether search engines will honor your setting.

on another note: while you’re at it, maybe you also want to look into adding canonical tags as you’re planning to serve the same content under two different domains, which from a SEO perspective isn’t ideal. canonical tags would also help Google picking up the correct domain for your translated content.

Hi thank you

Doesn’t shopify add canonicles automatically?

Hi @S02K , You can try the below code, hope this will work for you.

{% assign full_url = request.host | append: request.path %}
    {% if full_url contains '/en' %}
      
    {% endif %}

let me know if you face any issues with the above code.

Yes, but they will probably not point to the domain you want?

Oh, what pages would i want to be pointing towards eachother i am very new with these canonicals and coding is not really what i do.

and what code would i want to use in my theme to make this work

Thanks in advance!