diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 70413d9..b54ed66 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -572,10 +572,10 @@ function content_translation_page_attachments(&$page) { } $entity = $route_match->getParameter($name); - if ($entity instanceof ContentEntityInterface) { + if ($entity instanceof ContentEntityInterface && $entity->hasLinkTemplate('canonical')) { // Current route represents a content entity. Build hreflang links. foreach ($entity->getTranslationLanguages() as $language) { - $url = $entity->urlInfo() + $url = $entity->toUrl() ->setOption('language', $language) ->setAbsolute() ->toString();