I'm using the views breadcrumb functionality to implement breadcrumbs on a view. The problem I'm running into is I want a breadcrumb similar to this:

"Home > People > Search"

However, I'm getting this

"Home > People > Search >"

On my theme's configuration, I have the "Append the content title to the end of the breadcrumb" option checked. Unchecking this option removes the trailing ">" but now all my other breadcrumbs lack the page's title at the end of the breadcrumb.

Comments

MGN’s picture

Status: Active » Closed (won't fix)

If the theme is adding the trailing the > on the views page, then the theme needs to be modified to fix the problem. The theme does this insertion after the custom breadcrumbs module does its work, so there is nothing that can be done about it here.

Marking this as won't fix, but it should really be can't fix.

What theme are you using? You might want to move this issue to that queue to see if you can get some advice on how to fix the problem. It sounds like the theme just needs to check to see if has a valid title before adding the separator - shouldn't be difficult to fix.

Another approach would be to not use the theme level append, and use custom breadcrumbs to add the title on the end.

seancorrales’s picture

I'm using a custom theme based off Zen. I just tested with the default Zen theme and it does the same thing, as well. Since Zen is quite popular, it's at least worth finding out why this happens and providing a solution to avoid it.

"Another approach would be to not use the theme level append, and use custom breadcrumbs to add the title on the end."

Not an option for me on this particular project - we have over 900 pages of existing content and we just need the custom breadcrumbs for a couple of views.

seancorrales’s picture

Status: Closed (fixed) » Closed (won't fix)

I copied over Zen's breadcrumb function and added a simple if/then statement to resolve the issue. I'm pasting the modified breadcrumb code in here so anyone else who runs into the same issue might find this helpful.

/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *   An array containing the breadcrumb links.
 * @return
 *   A string containing the breadcrumb output.
 */
function zen_breadcrumb($breadcrumb) {
  // Determine if we are to display the breadcrumb.
  $show_breadcrumb = theme_get_setting('zen_breadcrumb');
  if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') {

    // Optionally get rid of the homepage link.
    $show_breadcrumb_home = theme_get_setting('zen_breadcrumb_home');
    if (!$show_breadcrumb_home) {
      array_shift($breadcrumb);
    }

    // Return the breadcrumb with separators.
    if (!empty($breadcrumb)) {
      $breadcrumb_separator = theme_get_setting('zen_breadcrumb_separator');
      $trailing_separator = $title = '';
      if (theme_get_setting('zen_breadcrumb_title')) {
        $trailing_separator = $breadcrumb_separator;
        $title = menu_get_active_title();

        //Check for empty title and kill separator if necessary.
		if($title == ''){
			$trailing_separator = '';
		}
      }
      elseif (theme_get_setting('zen_breadcrumb_trailing')) {
        $trailing_separator = $breadcrumb_separator;
      }
      return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>";
    }
  }
  // Otherwise, return an empty string.
  return '';
}
seancorrales’s picture

Status: Closed (won't fix) » Closed (fixed)
seancorrales’s picture

closing.

Status: Closed (won't fix) » Closed (fixed)