I was getting both page and article titles(duplicate) when displaying a node. On examination of node.tpl I see the code:
<?php if(!empty($user_picture) || !$page || (!empty($submitted) && $display_submitted)): ?>
<header class="clearfix<?php $user_picture ? print ' with-picture' : ''; ?>">
<?php print $user_picture; ?>
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1<?php print $title_attributes; ?>>
<a href="<?php print $node_url; ?>" rel="bookmark"><?php print $title; ?></a>
</h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
<div class="submitted"><?php print $submitted; ?></div>
<?php endif; ?>
</header>
<?php endif; ?>
I had opted for "Display author and date information" for article content types so (!empty($submitted) && $display_submitted)) is true so it was entering the if statement and printing the title. When I turned off submitted the article title disappeared.
Should the print title section not be wrapped in an if (!$page)? ie:
<?php if(!empty($user_picture) || !$page || (!empty($submitted) && $display_submitted)): ?>
<header class="clearfix<?php $user_picture ? print ' with-picture' : ''; ?>">
<?php print $user_picture; ?>
<?php if (!$page): ?>
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1<?php print $title_attributes; ?>>
<a href="<?php print $node_url; ?>" rel="bookmark"><?php print $title; ?></a>
</h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php endif; ?>
<?php if ($display_submitted): ?>
<div class="submitted"><?php print $submitted; ?></div>
<?php endif; ?>
</header>
<?php endif; ?>
I am surprised that no one else has noticed this so I wont be surprised if I am wrong!
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | title_duplicates.pdf | 406.25 KB | jchristophe |
Comments
Comment #1
Jeff Burnz commentedHmmm, I need to check this out. I'll post a fix etc shortly.
Comment #2
Jeff Burnz commentedI posted a fix but actually I missed more commits, wow, bad man, posting update shortly
Comment #3
Jeff Burnz commentedOK, this is a missed commits before release, so shit bugger, my bad...
There are several updates needed here - first in node tpl and then in page tpl - the idea is to print the title for nodes in node tpl always, and never in page tpl when viewing a node, this preserves the outline or page structure in HTML5.
node.tpl.php - use this instead:
page.tpl.php - the page title and "header" section is totally rewritten:
There is also a bit of extra CSS that should have been committed, for navigation.css this slots in around line 223:
and in page css we need to add div#tasks to the very first declaration in that file, i.e.
Comment #4
Jeff Burnz commentedI have committed these fixes to the dev version, so they will show when that is rebuilt (every 12 hours or so), I want to test this just a fraction more, if OK I will release a new version because this is a really bad miss and I too cannot believe no one else has reported it!
Comment #5
jimboh commentedGreat and thanks for your very speedy response!
Comment #6
alexandersluiter commentedI'm seeing the same thing on a site I'm developing. Keep us posted :)
Comment #7
Jeff Burnz commentedComment #8
justinledwards commentedIs this fixed in the stable version?
Comment #10
vildoc commentednot fixed in the stable version.
Comment #11
jchristophe commentedHi Jeff,
Has this issue been fixed in v7.x-2.2 as I'm still getting duplicate titles on articles and polls with Drupal 7.9 and AT Core 7.x-2.1.
I've updated the code as detailed above but no luck. Any idea? This does not happen with newly created custom content types.
Thank in advance,
JS
Comment #12
bkosborne#3 fixed the issue for me...
Comment #13
Jeff Burnz commentedIt should be fixed in the DEV version, I will be cutting new releases for the themes with updates at the end of this week.
Comment #14
jchristophe commentedAnd you are right... It does after all when I load the right copy of the theme... My bad...
Thanks for replying...
JS
Comment #15
jchristophe commentedThanks for the update Jeff and sorry for the trouble... Great theme... Will be waiting for next release...
Thanks again, JS
Comment #16
iGetcha commented#3 worked for us too on http://www.cybermidnight.com Thanks Jeff!