Hi

How to add rel="author" with my Google + link to the "Submitted by" link?
I have several autors and want have different thumbnails in serps for each author.

Thank you

Comments

Jeff Burnz’s picture

Its possible you can do this in theme_username http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_usern...

Such as adding to the attributes array, something like this (not tested, adjust the function name for your theme, clear the cache etc, you use this in template.php):

function theme_username($object) {

  if ($object->uid && $object->name) {
    // Shorten the name when it is too long or it will break many tables.
    if (drupal_strlen($object->name) > 20) {
      $name = drupal_substr($object->name, 0, 15) . '...';
    }
    else {
      $name = $object->name;
    }

    // Add the rel author attribute for Googles authorship program
    if (user_access('access user profiles')) {
      $output = l($name, 'user/' . $object->uid, array(
        'attributes' => array(
          'title' => t('View user profile.'),
          'rel' => 'author',
          )
        )
      );
    }
    else {
      $output = check_plain($name);
    }
  }
  else if ($object->name) {
    // Sometimes modules display content composed by people who are
    // not registered members of the site (e.g. mailing list or news
    // aggregator modules). This clause enables modules to display
    // the true author of the content.
    if (!empty($object->homepage)) {
      $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
    }
    else {
      $output = check_plain($object->name);
    }

    $output .= ' (' . t('not verified') . ')';
  }
  else {
    $output = check_plain(variable_get('anonymous', t('Anonymous')));
  }

  return $output;
}
Jeff Burnz’s picture

Of course in Adaptivetheme 7.x this is a theme setting, you can just turn it on ;)