Rick Snippets là một cách hiện thị nhãn để mô tả loại hình cụ thể của thông tin, chẳng hạn như một nhận xét về món ăn nhà hàng , một sự kiện, một người, hoặc niêm yết một sản phẩm. Những loại thông tin đó được gọi là các mục. Mỗi mục có một số các đặc điểm nhận dạng. Ví dụ, một người có tên, địa chỉ, chức danh, công việc, công ty, và địa chỉ email. Nói chung, Rick Snippets sử dụng các thuộc tính đơn giản trong các thẻ XHTML (thường <span> hoặc <div>) để chỉ định tên ngắn gọn và mô tả cho các thực thể và các đặc điểm cá nhân. Dưới đây là một ví dụ HTML ngắn hiển thị thông tin liên lạc cơ bản cho Lamvt.
Bạn cũng có thể thảo luận tại
viewtopic.php?f=27&t=209
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person">
My name is <span property="v:name">Vu Thanh Lam</span>,
but people call me <span property="v:nickname">Lamvt</span>.
Here is my homepage: <a href="http://www.tinbaohiem.com" rel="v:url">www.tinbaohiem.com</a>.
I live in HaNoi VietNam and work as a <span property="v:title">freelancer</span>.
<span rel="v:Review">
<span typeof="v:Review-aggregate">
<span rel="v:rating">
<span typeof="v:Rating">
<span property="v:average">4.5</span> stars based on
<span property="v:count">500</span> reviews
</span>
</span>
</span>
</span>
</div>
ngoài ra có rất nhiều kiểu demo cho bạn lựa chọn phù hợp với site của mình:
Rich snippets types
Breadcrumbs
Events
Music
Organizations
People
Products
Recipes
Review ratings
Reviews
Software applications
Supported software application types
Videos: Facebook Share and RDFa
Trong bài này mình giới thiệu về Rick Snippets Reviews để làm đẹp kết quả tìm kiếm tạo sự chú ý cho người đọc: (xem hình)
Mình đã làm cho site này :
http://tinbaohiem.com/ và đây là kết quả:
để làm điều này cho wordpress site bạn thêm dòng code sau vào file footer.php trong themes của bạn nhé:
<?php if(is_single() ){
//To Pull 7 Unique Random Values Out Of AlphaNumeric
//removed number 0, capital o, number 1 and small L
//Total: keys = 32, elements = 33
$characters = array(
"A","B","C","D","E","F","G","H","J","K","L","M",
"N","P","Q","R","S","T","U","V","W","X","Y","Z",
"1","2","3","4","5","6","7","8","9");
$characters2 = array("1","2","3","4","5","6","7","8","9");
//make an "empty container" or array for our keys
$keys = array();
//first count of $keys is empty so "1", remaining count is 1-6 = total 7 times
while(count($keys) < 7) {
//"0" because we use this to FIND ARRAY KEYS which has a 0 value
//"-1" because were only concerned of number of keys which is 32 not 33
//count($characters) = 33
$x = mt_rand(0, count($characters)-1);
if(!in_array($x, $keys)) {
$keys[] = $x;
}
}
foreach($keys as $key){
$random_chars .= $characters[$key];
$random_chars2 .= $characters2[$key];
}
//echo $random_chars;
?>
<div class="copyright">
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review">
<span property="v:itemreviewed"><?php the_title(); ?></span>
Reviewed by
<span property="v:reviewer"><?php echo $random_chars; ?></span> on
<span property="v:dtreviewed" content="<?php the_time('j-m-Y'); ?>"><?php the_time('j-m-Y'); ?></span>.
<span property="v:summary"><?php tj_content_limit('40'); ?></span>
<span property="v:description"><?php tj_content_limit('240'); ?></span>
Rating:
<span property="v:rating">4.5</span> stars based on
<span property="v:count"><?php echo $random_chars2; ?></span> reviews.
</div>
</div>
<?php }else { ?>
<div class="copyright">
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person">
My name is <span property="v:name">Vu Thanh Lam</span>,
but people call me <span property="v:nickname">Lamvt</span>.
Here is my homepage: <a href="http://www.tinbaohiem.com" rel="v:url">www.tinbaohiem.com</a>.
I live in HaNoi VietNam and work as a <span property="v:title">freelancer</span>.
<span rel="v:Review">
<span typeof="v:Review-aggregate">
<span rel="v:rating">
<span typeof="v:Rating">
<span property="v:average">4.5</span> stars based on
<span property="v:count">500</span> reviews
</span>
</span>
</span>
</span>
</div>
</div>
<?php } ?>
Goodluck