It would be better for browser navigation if the page title reflected the content of the page, rather than always saying "archives". Same with the page breadcrumb. This usually works automatically, but doesn't seem to with the Archive module.

Comments

Susurrus’s picture

I do agree with the page title, it should be changed depending on the current date and content type that you're viewing.

I feel differently about the breadcrumbs. While I agree that they're normally helpful and allow users to jump around the site quickly, I feel that the breadcrumbs aren't necessary for the archives as they're already recorded up at the top where you can select data and date. Unless I hear from other people regarding this, I think I'm going to leave the breadcrumbs the way they are.

junyor’s picture

At the very least, could you give me some hints on updating the breadcrumbs?

Susurrus’s picture

  $month_names = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
  $breadcrumbs = array();
  if ($year) {
    $breadcrumbs[] = l(t($month_names[$month], _archive_url($type));
  }
  if ($month) {
    $breadcrumbs[] = l(t($month_names[$month], _archive_url($type, $year));
  }
  if ($day) {
    $breadcrumbs[] = l(t($month_names[$month], _archive_url($type, $year, $month));
  }
  drupal_set_breadcrumb($breadcrumbs);

Add that code to the top of the archive_page function. I haven't tested it, but it should be close to correct.

Susurrus’s picture

Status: Active » Closed (fixed)

Fixed in 1.7

junyor’s picture

Now that I've played with it, I agree that it's better without the breadcrumb for each part of the archive. If anyone wants to have that, though, here's the code:

  $month_names = _get_month_names();
  $breadcrumbs = drupal_get_breadcrumb();
  $breadcrumbs[] = l('Archives', 'archive');  

  if ($year) {
    $breadcrumbs[] = l($year, _archive_url($type));

    if ($month) {
      $breadcrumbs[] = l(t($month_names[$month]), _archive_url($type, $year));

      if ($day) {
        $breadcrumbs[] = l($day, _archive_url($type, $year, $month));
      }
    }
  }

  drupal_set_breadcrumb($breadcrumbs);

@Susurrus: I'm not incredibly versed on t() usage, but shouldn't there be t()'s around each month name in _get_month_name() rather than when using the month name via a variable?

junyor’s picture

@Susurrus: BTW, thank you!

junyor’s picture

Actually, my code is wrong. The first use of _archive_url() should probably just be 'archive', since _archive_url() expects at least two parameters.