Currently, menu_set_active_trail() forces the title of the front page to be Home, regardless of what the page specifies as its title in the menu system. One has to use drupal_set_title() from the page callback to override this.

Related issues

CommentFileSizeAuthor
#1 drupal8.menu-title-frontpage.1.patch1.33 KBsun

Comments

sun’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

Related:
#1013730: Drop page title derived from active trail (breadcrumb) behavior
#111081: Output title of current local task in HEAD title (e.g., "People » List")
#996302: Pages of local actions don't display local action title as page title
#1041906: Taxonomy term menu link title overrides term page title

However, re-reading the OP once more (vastly different than the issue title), the special "Home" page title behavior is completely independent from all of these issues and applied in menu_set_active_trail().

FWIW, the functions of interest are:
http://api.drupal.org/api/drupal/core!includes!menu.inc/function/menu_se...
http://api.drupal.org/api/drupal/core!includes!menu.inc/function/menu_ge...
http://api.drupal.org/api/drupal/core!includes!menu.inc/function/menu_ge...

However, the problem space is that the front page does not have a menu link.

The menu system takes over the title of the last menu link in the active trail (~breadcrumb) as the page title.

But the front page is only configured to point to a certain router path in the system. There is no menu link in the active trail for it.

Also, we do still want the active trail (~breadcrumb) to contain "Home" when you are not on the front page.

So what you'd have to do would be along the lines of attached patch. Untested.

tstoeckler’s picture

Issue tags: +Needs tests

Looks great!
I think this needs tests, though. Would be great to utilize the new test_page_test.module.

webchick’s picture

Suggestion: take the change over at #1811804-18: Provide a test page testing module and do it here, and wrap an assert around it.

sun’s picture

We can do this for now.

But I want to point out that there's actually some hope that the page title won't be derived from the router/links at all anymore. I doubt that there's a concrete plan already for how special, pluggable, built-in pages like the front page are going to be handled in the new router and controller and blocks and layouts world, but at least for all other routes, the controller will likely be responsible for setting (or returning) an appropriate page title; if it doesn't, then there will be no title.

damien tournoud’s picture

Let's not confuse two things:

  • The title of the Home link in the breadcrumb
  • The title of the homepage

The latter is set from the former on the homepage if there is no explicitly set title.

The current patch introduces a weird situation in which the breadcrumb link for Home might have a different label depending on the situation. That's just not acceptable.

If we want to go that route, we should explicitly load the preferred menu link for the homepage and use its title for the first breadcrumb entry.

Status: Needs review » Needs work

The last submitted patch, 1: drupal8.menu-title-frontpage.1.patch, failed testing.

dawehner’s picture

Version: 8.0.x-dev » 7.x-dev
Issue summary: View changes

The d8 default page title is "Welcome to site-install" which is coming from the content itself. Let's move this to d7.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.