Is there anyway to add the current page title on drupal 7 breadcrumb?

  • just implemented this on my theme Jul 23 '11 at 20:01

Some themes - like Zen - provide this option, so check under Appearance -> Settings. If your theme doesn't offer the option, you can edit your theme's page.tpl.php - simply add $title after the $breadcrumb variable. Alternatively you could override theme_breadcrumb().


You could also use the Menu breadcrumb module to do this (it has D6 and D7 versions too).
It allows you to

"Append the page title to the breadcrumb (either as a clickable url or not)"

See this tutorial:
Tutorial - How to Work and Style Breadcrumbs in Drupal 7

Menu breadcrumb

Menu breadcrumb - It uses the menu hierarchy to determine the breadcrumb trails.


As a side note, if you are coding your breadcrumb trail in the template.php file, the page title will be added in the breadcrumbs to any [custompage].tpl.php file automatically.

I am not saying it's a better way of doing it. Personally, it was a more convenient solution for me, as i have multiple [page].tpl.php files.

(I also changed the default output to <li> list items, in order to get the CSS markup right.)

function templatename_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];
  $crumbs = '';
  if (!empty($breadcrumb)) {
    $crumbs = '<div id="breadcrumbs"><span>You are here: </span><ul>';
    foreach($breadcrumb as $value) {
      $crumbs .= '<li>' . $value . '</li>';
    $crumbs .= '<li>' . drupal_get_title() . '</li></ul></div>';
  return $crumbs;

Maybe this is of some help to anyone.

  • did you notice the page title is not inside a <li>? Nov 27 '11 at 13:42
  • 1
    ah, yes, I had left out some parts of my code of which I thought they were irrelevant in my answer. Apparently, I was a bit too enthousiastic in stripping the code. Thank you for noticing, I have updated my post. Nov 29 '11 at 13:05

You could use the Custom Breadcrumbs module it has an option where you can include the current page title (or any other token field)


If you want to have breadcrumb in a block, you can create a block with the following content:

$bcarr = drupal_get_breadcrumb();
$bcarr [] = drupal_get_title();
print  theme('breadcrumb', array('breadcrumb'=>$bcarr));

This is for Drupal 7 and the content type should be PHP code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.