Replicating a Node with Replicate UI Leads to an Incorrect Hreflang Tag 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:

&lt;link href="https://de.website.com" rel="alternate" hreflang="en" /&gt;


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()