From 0d8515deb750fe2a02ee6f9f12860caceed7248f Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 3 Nov 2009 06:47:23 +0000 Subject: #552478 by pwolanin, samj, dropcube, and sun: Improve link/header API and support on node/comment pages rel=canonical and rel=shortlink standards. --- modules/node/node.module | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index 84cc776ff..735fc30c4 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -2152,6 +2152,10 @@ function node_page_view(stdClass $node) { if (isset($return['nodes'][$node->nid]['title'])) { drupal_set_title($return['nodes'][$node->nid]['title']['items'][0]['#item']['value']); } + // Set the node path as the canonical URL to prevent duplicate content. + drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url('node/' . $node->nid)), TRUE); + // Set the non-aliased path as a default shortlink. + drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url('node/' . $node->nid, array('alias' => TRUE))), TRUE); return $return; } -- cgit v1.2.3