Hiding Node Titles

Events happening in the community are now at Drupal community events on www.drupal.org.
Anonymous's picture

I'm loving Drupal and I'm slowly learning my way around it but there is one thing I cant get my head around and that is hiding the node titles. I have tried multiple ways but they just don't seem to do anything. It's the last thing I want to do before sending my site out into the real world.

My site is http://www.crowdsafety.com.au and I want to hide the node titled "Story 9" Can anybody please explain how to do it?

Thank you!

Comments

Looked at the site. You are

gollyg's picture

Looked at the site. You are actually viewing the default node listing page as your home page. This is the default, and can be set from 'Site configuration > Site information'. This listing is designed to list teasers for all content on your site - as you only have one page it shows a very short list!

As the format of this list is more or less set, you probably need to set the home page to something other than the node listing page. You only seem to have one page on your site, so perhaps this is meant to be the home page? You should be able to set that at the page above ('Site configuration > Site information'), under Default frontpage. Change this to 'node/9' to use that page as your home page.

If you plan to have more content, and you want to list this without page titles, you may want to consider the Views module (http://drupal.org/project/views). Create a view, include the required fields, and then set it as the front page.

Now, this 'full view' of the node would normally show a node title, but you seem to have managed to hide it (through the theme?).

hth

gollyg, Thanks for your help

feedyourfeet's picture

gollyg,

Thanks for your help but putting the node as the default front page just moves the node title to the title bar. Is there any code that I can comment out to stop it from showing? I don't plan on having more content at this moment in time.

How about something like

jaime@gingerrobot.com's picture

How about something like this.

In page.tpl.php

<?php
if ($title & $page !=5) {
       print
"<h1 class='page-title'>".$title."</h1>\n";
}
?>

where "5" is the node ID o your page.

You could also copy page.tpl.php to page-front.tpl.php and do whatever to that one.

J.

jaimekristene, Thank you. I

feedyourfeet's picture

jaimekristene,

Thank you. I will try it when I get into work. Can I place it anywhere in the code or does it need to replace it?

Hi! In your theme which is

jaime@gingerrobot.com's picture

Hi!

In your theme which is different to mine, you need to find the area where it prints the title and put that if statement around it.

J.

I cant seem to find where to

feedyourfeet's picture

I cant seem to find where to put it. I have uploaded the page.tpl.php to here http://dl.dropbox.com/u/225342/page.tpl.php

If you want to do this for an

jaymiejones86's picture

If you want to do this for an individual node only, you can copy the node.tpl.php file into your theme directory, duplicate it and name it node-5.tpl.php, replacing 5 with the node ID of the node you want to edit, then simply remove the PHP that prints the node's title.

If you want them gone from all nodes no matter what, just copy the node.tpl.php file into your theme directory and remove the PHP that prints the node's title.

I have tried the first

feedyourfeet's picture

I have tried the first suggestion and it does not seem to work.

Add new function for template.php

tvazone's picture

Add code below:
function ebizon_redfire_preprocess_page(&$vars) {
if (drupal_is_front_page()) {
$vars['title'] = NULL;
}
}

into ebizon_redfire/template.php

Automatic Nodetitles

reddyweb's picture

There is a simple module to hide node titles. Here you can find the url for contributed "Automatic Nodetitles" module.

http://drupal.org/project/auto_nodetitle

After enabled this module, you can have a options in content type /admin/content/node-type/page -> work flow settings -> HIDE THE NODE TITLE:

Thanks.

Negative

miller.t.chris@gmail.com's picture

This does not hide the node title, it just hides the node title field.

Hidden title / H1 effect on SEO

enap's picture

Recently wanted to hide node titles on a site, however thought it might negatively effect SEO.

After a bit of discussion on IRC, ended up deciding have a radio button / toggle field in the Page content type to show/hide title, which applies a class to the h1 tag in page.tpl.php.
I then hid the title using javascript, as far as I know search engine spiders/robots ignore javascript, so to them the title would still appear.

So, in page.tpl.php:

<?php if ($title): ?>
  <h1 class="title<?php if ( $node->field_showtitle[0]['value'] == 'No' ) { print ' hidetitle'; } ?>"><?php print $title; ?></h1>
<?php endif; ?>

In a js file attached to the theme (in Drupal.behaviors...):

$('.hidetitle').hide();

This way I (or the non-savvy site manager) can always choose if it appears easily, simply by editing the node. I'm not sure if this is the correct approach, but it works well.

UI version

silkogelman's picture

http://drupal.org/project/exclude_node_title

it gives you two options:
option 1: show a title hide checkbox on the node edit form

option 2: a config screen that lets you enter node id's or check entire content types

Exclude node title

spatil1007's picture

Thanks s1l
The http://drupal.org/project/exclude_node_title is working fine. Don't need to do any coding or changes in page.tpl.php or node.tpl.php

Was looking for the same type of solution.

Sachin
www.3stechnograph.com

Australia

Group categories

Location

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: