Post Reply 
Microformats: Google Rich Snippets
24-Jan-2011, 04:08 PM
Post: #1
Microformats: Google Rich Snippets
I wonder if is possible to integrate the commentics stars rating system with Google Rich Snippets Microformats to appear in search results.

Thank you.
Find all posts by this user
Quote this message in a reply
24-Jan-2011, 10:00 PM
Post: #2
RE: Microformats: Google Rich Snippets
This is totally new to me so I need a bit of time to learn about Rich Snippets first. I assume that the Review markup would be the appropriate type of snippet? Do you want the star ratings to be displayed in an aggregate way, as opposed to individual, so that it gives an overall view of the ratings?

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
25-Jan-2011, 08:35 AM
Post: #3
RE: Microformats: Google Rich Snippets
Exactly. I am interested in the score can change dynamically.
Find all posts by this user
Quote this message in a reply
25-Jan-2011, 01:33 PM
Post: #4
RE: Microformats: Google Rich Snippets
This is what I have come up with. I have written it so that the 'page reference' is used as the title. Can you please test the markup for me.

In comments/includes/template/comments.php, find this part:
PHP Code:
if ($average_rating != 0) {
echo 
$output_average_rating;
echo 
"<span class='average_rating_text'>";
echo 
" " CMTX_AVERAGE_RATING;
echo 
"</span>";


And replace it with this:
PHP Code:
if ($average_rating != 0) {
echo 
$output_average_rating;
echo 
"<span class='average_rating_text'>";
echo 
" " CMTX_AVERAGE_RATING;
echo 
"</span>";
//Start of Google 'Rich Snippets' (Microformats markup)
$number_of_ratings mysql_query("SELECT COUNT(*) FROM `".$mysql_table_prefix."comments` WHERE is_approved = '1' AND rating != '0' AND page_id = '$page_id'");
$r mysql_fetch_row($number_of_ratings);
$number_of_ratings $r[0];
echo 
"<div class='hreview-aggregate'>";
echo 
"<span class='item'>";
echo 
"<span class='fn'>" cmtx_get_page_reference() . "</span>";
echo 
"</span>";
echo 
"<span class='rating'>";
echo 
"<span class='average'>$average_rating</span>";
echo 
"<span class='best'>5</span>";
echo 
"</span>";
echo 
"<span class='votes'>$number_of_ratings</span>";
echo 
"<span class='count'>$number_of_comments</span>";
echo 
"</div>";
//End of Google 'Rich Snippets'


Then add this to your CSS stylesheet:
Code:
.hreview-aggregate {
display: none;
}

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
25-Jan-2011, 02:47 PM
Post: #5
RE: Microformats: Google Rich Snippets
Wow..!!! You're amazing. Fantastic.
Thanks, Steven.

[Image: richm.jpg]
Find all posts by this user
Quote this message in a reply
25-Jan-2011, 07:21 PM
Post: #6
RE: Microformats: Google Rich Snippets
I'm glad it worked. Hopefully others will also find it useful.

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
04-Aug-2011, 07:41 PM
Post: #7
RE: Microformats: Google Rich Snippets
Modified

'commentics_1.6/comments/includes/functions/comments.php'

to show also 'hreview' (not 'aggregate', the single ones) Google 'Rich Snippets' (Microformats markup).

-----------------------------------------------------

Google test tool shows something like this for every comment:

hreview
item fn = Šotori, bungalovi, senčnice, paviljoni, zastave, stojnice - zastopstvo in prodaja.
reviewer hcard
fn = stariocek
rating
value (normalized to 5.0 scale) = 5.0
value = 5
description = komentarji delajo! lp, admin


Attached File(s) Thumbnail(s)
   

.php  comments.php (Size: 13.42 KB / Downloads: 13)
Find all posts by this user
Quote this message in a reply
06-Aug-2011, 12:04 PM
Post: #8
RE: Microformats: Google Rich Snippets
Second version of comments.php, now without hidden text for comment - better for SEO.


Attached File(s)
.php  comments.php (Size: 13.55 KB / Downloads: 26)
Find all posts by this user
Quote this message in a reply
06-Aug-2011, 01:05 PM
Post: #9
RE: Microformats: Google Rich Snippets
(06-Aug-2011 12:04 PM)stariocek Wrote:  Second version of comments.php, now without hidden text for comment - better for SEO.

Third version of comments.php, Rich Snippets completely incorporated into initial code. Without ugly tricks for testing purposes.


Attached File(s)
.php  comments.php (Size: 13.63 KB / Downloads: 45)
Find all posts by this user
Quote this message in a reply
13-Dec-2011, 03:36 PM
Post: #10
RE: Microformats: Google Rich Snippets
Tried to upload your comments.php and it breaks the page. Sad
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  problem with google. kunalp 4 391 12-Oct-2012 07:43 PM
Last Post: Steven
  Google Rich Snippets Testing Tool does not show any data poropopo 2 369 12-Jul-2012 12:29 PM
Last Post: poropopo
  Rich Snippets in 1.7. Norbs 1 441 27-Nov-2011 02:27 PM
Last Post: Steven

Forum Jump:


User(s) browsing this thread: 1 Guest(s)