diff --git a/core/modules/node/src/Controller/NodeViewController.php b/core/modules/node/src/Controller/NodeViewController.php index 2e68391..03e02dd 100644 --- a/core/modules/node/src/Controller/NodeViewController.php +++ b/core/modules/node/src/Controller/NodeViewController.php @@ -25,27 +25,23 @@ class NodeViewController extends EntityViewController { $build['#title'] = $build['nodes']['#title']; unset($build['nodes']['#title']); - foreach ($node->uriRelationships() as $rel) { - // Set the node path as the canonical URL to prevent duplicate content. - $build['#attached']['html_head_link'][] = array( - array( - 'rel' => $rel, - 'href' => $node->url($rel), - ), - TRUE, - ); + // Set the node path as the canonical URL to prevent duplicate content. + $build['#attached']['html_head_link'][] = array( + array( + 'rel' => 'canonical', + 'href' => $node->url(), + ), + TRUE, + ); - if ($rel == 'canonical') { - // Set the non-aliased canonical path as a default shortlink. - $build['#attached']['html_head_link'][] = array( - array( - 'rel' => 'shortlink', - 'href' => $node->url($rel, array('alias' => TRUE)), - ), - TRUE, - ); - } - } + // Set the non-aliased canonical path as a default shortlink. + $build['#attached']['html_head_link'][] = array( + array( + 'rel' => 'shortlink', + 'href' => $node->url('canonical', array('alias' => TRUE)), + ), + TRUE, + ); return $build; }