In a fresh installation of d7, when enabling and setting the Seven theme, the site name disappears of front page when an article is promoted to front.

When no article is promoted, the site name appears such as "Welcome to $site_name" under the toolbar.

Steps to reproduce the bug :
1. Create an article
2. Promote it to front page

Expected :
"Welcome to $site_name" under the toolbar inside a h1 tag.

Instead :
The site name does not appear, there's even no h1 tag at all. When the article is demoted from frontpage, the site is back where and how it should.

Hint from the code :
In the page.tpl.php of the Seven theme, there is

<?php if ($title): ?>
  <h1 class="page-title"><?php print $title; ?></h1>
<?php endif; ?>

If I remove the if statement and leave only the line with the h1 tag, when the bug occurs the h1 appears but gets empty. So the problem may come from how the $title variable is populated, but I can't find where...

Comments

wapnik’s picture

Status: Active » Needs review
StatusFileSize
new973 bytes

inspired by bartik and zen themes

Jeff Burnz’s picture

StatusFileSize
new780 bytes
+++ themes/seven/page.tpl.php	25 Aug 2010 21:48:11 -0000
@@ -5,8 +5,12 @@
+    <?php if ($site_name): ?>
+      <?php if ($title): ?>
+        <h1 class="page-title"><?php print $title; ?></h1>
+      <?php else: ?>
+        <h1 class="page-title"><?php print $site_name; ?></h1>
+      <?php endif; ?>

Good start but this implies that by toggling the site name off in theme settings it will nuke the page title, which is unexpected result.

Maybe something like this patch:

Status: Needs review » Needs work

The last submitted patch, seven-page-title-891560_2.patch, failed testing.

Jeff Burnz’s picture

Status: Needs work » Needs review
StatusFileSize
new911 bytes

Ops...

I think this might need an rdfa review for semantics - not sure about wrapping the site name in the $title_prefix, $title_suffix stuff?

Status: Needs review » Needs work

The last submitted patch, seven-page-title-891560_3.patch, failed testing.

Jeff Burnz’s picture

ok, so no idea what is going here, dam you bot...

wapnik’s picture

StatusFileSize
new767 bytes

Yes agree, bad inspiration in my case, these themes works quite a bit different.

Problem with your patch seems to be line-endings. Trying it again.

These $title_prefix, $title_suffix, are they intended to be displayed if there will be no title displayed? I mean shouldn't they go inside the condition? The same question for all the other themes.

wapnik’s picture

Status: Needs work » Needs review
Jeff Burnz’s picture

I spoke with some rdfa peeps yesterday and popped the same question about the prefix/suffix being outside the condition, apparently thats how its meant to work. Will check my line endings, weird cause I just posted like 20 other patches in the last day or so and no issues, grrrrr....

DjebbZ’s picture

I found why there was no site name as page title (h1). In node.module, in the function node_page_default() there is :

if (!empty($nids)) {
   ...
    drupal_set_title('');
  }
else {
...

Basically if there is one or more node to load, the function empties the $title variable. So normally the theme takes care of displaying a h1 tag with something in it. And as the Seven theme doesn't by design, the "header" gets empty. If I understand the philosophy of the Seven theme, it's because it's an administration theme only.

The changes you made in the page.tpl.php changes this design, but it's not a bad idea to have something always appearing in this "header" region, like the site name.

reglogge’s picture

Status: Needs review » Closed (works as designed)

I don't really see the point here at all. Seven is explicitly declared as an administration theme - it's not intended to be the default theme for a website.

In this light, the described behavior makes sense and is not buggy at all. Seven displays page titles correctly when used as it is meant to be used.

While the patch in #7 works, I'm afraid were opening a can of worms here with more issues popping up trying to adapt Seven to a task (being a site's default theme) it's explicitly not meant to fulfill.

Jeff Burnz’s picture

Yep, I actually agree with this, if a user really wants to use Seven as the front end theme they can always subtheme it and add this themselves.