we are using the Replicate UI module to replicate nodes and then changing the new replicates language to build up our site in different languages.

However, we are seeing an issue with our Hreflang tags where the hreflang tag gets the correct url of the new node, but keeps the old language code.

So let's say the old node was in English and the new one is in German - the hreflang tag still says that the new version hreflang that still contains "en" rather than "de" like that:

<link href="https://de.website.com" rel="alternate" hreflang="en" />

The question is, how can we change the hreflang code once the page is replicated? We have multiple pages that we do not want to create from scratch.


As the module's page on https://www.drupal.org/project/hreflang says if it's for Drupal 8, then you should implement hook_language_switch_links_alter() or hook_page_attachments_alter() to modify the hreflang tags. If it's for Drupal 7 then use either hook_language_switch_links_alter() or hook_html_head_alter()

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.