node_page_view

Versions
5 – 6
node_page_view($node, $cid = NULL)
7
node_page_view($node)

Menu callback; view a single node.

Code

modules/node/node.module, line 2172

<?php
function node_page_view($node) {
  $return = node_show($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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.