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
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.