I would like to be able to edit my H1 tags so that I decide the content that goes in them. Currently by default on each page Drupal is putting the page's title in the H1 tags. I would strongly prefer for the page title not to have H1 tags. I would like to be able to define them myself.
How can I do this? Is it possible
Thanks

Comments

barrett’s picture

Check out your theme's page.tpl.php file.

Anonymous’s picture

Thanks for the suggestion. Would you be able to advise me on what should be changed?
Thanks!

conorc’s picture

<h1 class="title"><?php print $title ?></h1>

be sure to check how to intercept and override a default theme if you are not using a custom or contributed one.

Anonymous’s picture

Ok thats the bit I'd actually focussed on myself. But would you know what I should do with it? Bearing in mind ideally I don't want Drupal to generate an H1 tag and that I'd like to be able to input my own.
Thanks!

conorc’s picture

Well, if I'm understanding your request, you could comment out the contents of the current h1 tag so that it doesn't appear on any page and then manually input your own on each page.

BTW: I'm not really sure why you'd want to do this, maybe further clarification might help.

best regards,

Anonymous’s picture

Thats exactly what i'd like.
I'd like to do this so that I can actually choose what goes in my H1 titles. Sometimes I like to make them shorter or slightly different to my page title although making sure both contain important keyword.
Thank you

Anonymous’s picture

As basic as I'm sure this is I've still not managed to stop the H1 tags from being automatically places on my page...
Can anyone provide any further advice.
Thanks

barrett’s picture

What code did you put into the file to make the change?

If you're going to edit the page.tpl.php file (and I'm not saying that's the way to go. It may be possible to do it in a theme function), basically, you need to

  1. find the line in your page.tpl.php that conorc referenced earlier in the thread
  2. Above that line put in some code to test what page is being displayed and set a variable with the content that you want to appear in the h1 tags
  3. Edit the current line to print you new variable rather than the $title variable
  4. Enjoy
Anonymous’s picture

Thank you for going to this effort. I have accomplished my goal!
Cheers

gingerfrog’s picture

page-title is what you are looking for. It will create a new field in the node that will then be used to fill browser title bar. You effectively find your self with a "simple" title you can use for pathauto/general content title.. and another where you can add as many keywords to without making your site look like an lexicon ;)