I noticed that there is a variable $page in node.tpl.php and it is usually TRUE.
The node title is not displayed while it is TRUE, but in page.tpl.php, the node title has been displayed as a page title. The below is the code snippet from node.tpl.php of Bartik theme.

  <?php if (!$page): ?>
    <h2<?php print $title_attributes; ?>>
      <a href="<?php print $node_url; ?>"><?php print $title; ?></a>
  <?php endif; ?>

When the variable is FALSE, the node title in node.tpl.php will be displayed and it seems like duplicate title being displayed. I tried this:

function bartik_preprocess_node(&$variables) {
  if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
    $variables['classes_array'][] = 'node-full';
  $variables['page'] = FALSE;

What is the purpose of this variable and when does it become FALSE?.


The variable $page is TRUE if the node is being shown in its own full page.

If the path is "node/34", $page is TRUE.
If the path is "taxonomy/term/5", $page is FALSE.

If the node is tagged to taxonomy term 5, it will also be displayed in node listing page at "taxonomy/term/5" in teaser by default. So you do need to add the title and attributes with a link to the node.

But in the full page, title is printed at the page.tpl.php level so you don't need to print it again.

The variable $teaser is usually the inverse of $page but you can pass $teaser and $page both FALSE by making a View on content (not fields) to show full node.

Use $page to determine the path of the node. If it's already the node path, you don't have to make a link to node.

  • @Sithu thanks for the edits. I'm in a train with a mobile right now so formatting is just like Lil Wayne's face or songs. – AyeshK Jan 29 '13 at 4:14
  • you're welcome, I'm in the office. Edits can be done easily :) – Sithu Jan 29 '13 at 4:19
  • I'm not clear on your last paragraph. – Sithu Jan 30 '13 at 3:43

That variable becomes false in:



$variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node);

See also:


For the view_mode parameter used there.

The output of the node $title is controlled by page.tpl.php for the full page node view.

  • Thanks, David. It sounds like you only answered the second part of the question. – Sithu Jan 29 '13 at 3:46
  • The output of the node $title is controlled by page.tpl.php for the full page node view. – David Thomas Jan 29 '13 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.