Can't tell if this is even available on the D7 version, but will someone be adding Google rich snippets for either version?

Comments

LeMale’s picture

I am exactly in the same situation, I try to integrate the Microdata from schema.org into fivestar but I do not know where to begin, someone can tell me a solution?

LeMale’s picture

no one can provide a solution ?

ericduran’s picture

Category: feature » support

Is already in D7, not sure it'll make it to D6, instead I would probably recommend over writing the display in D6 and filling out the correct micro-formats. That would be simpler.

I don't think we'll actually get MicroData working with D6.

sbonde’s picture

I got Microdata working fine on several Drupal 6 installations using Fivestar 6.x-1.20 and Voting API 6.x-2.3.

I changed the Fivestar CCK field to show 5 stars and added the following to the review page:

<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
	<meta itemprop="worstRating" content="1">
	<meta itemprop="ratingValue" content="<?php $rating = $node->field_rating[0]['rating']; print $rating / 20; ?>">
	<meta itemprop="bestRating" content="5">
</div>

Change "$node->field_rating[0]['rating']" with your own CCK field name.

I had to print the Fivestar CCK field like this in order to get the correct amount showing.
If I was using $node->field_rating[0]['stars'] it would just print the stars available, so that would result in 5 out of 5 everytime.

For Google Rich Snippets breadcrumb markup I added the following to the template.php file:

/*
* Allow themable breadcrumbs
*/
function themename_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    $lastitem = sizeof($breadcrumb);
    $crumbs = '<div class="breadcrumb">';
    $a=1;
	$search = array('">', '</a>');
	$replace = array('" itemprop="url"><span itemprop="title">', '</span></a>');
    foreach($breadcrumb as $value) {
        if ($a!=$lastitem){
         $crumbs .= '<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="item">'.str_replace($search, $replace, $value).' &raquo; </div>';
         $a++;
        }
        else {
            $crumbs .= '<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="item">'.str_replace($search, $replace, $value).'</div>';
        }
    }
    $crumbs .= '</div>';
  }
  return $crumbs;
}

Just replace "themename" with the name of your own theme.

Hope this can be of use to someone.

plazik’s picture

Thanks you, Klaphatten.
Breadcrumbs works for me fine.

ericduran’s picture

Status: Active » Closed (won't fix)

This has been mention before.

You can make Fivestar show google rich snippet by just spitting the output yourself just like @Klaphatten. In Drupal 7 this works with the microdata module to make it possible. But in short we won't support it.

That being said, We wont turn down any patches ;-)