I have a content page in English with Japanese and Chinese translations. Even when I unpublished the translation nodes, the page source code will display the hreflang attributes to the unpublished languages in header.
<link rel="alternate" hreflang="en" href="https://testsite.com/dining.html" />
<link rel="alternate" hreflang="ja" href="https://testsite.com/ja/dining.html" />
<link rel="alternate" hreflang="zh-hans" href="https://testsite.com/zh-hans/dining.html" />
This seems to be generated automatically. And when I run a test for SEO these language links throws 404 error because they are unpublished. How do I remove the unpublished links from the hreflang. (And it should be automatically added when I publish the translations)
hook_page_attachments_alter
or perhaps this module drupal.org/project/content_language_access might be usefull – GiorgosK Mar 22 '19 at 8:04