Powered by Blogger.

Cách tạo Rich Snippet Breadcums cho Joomla 1.5.x

Hôm nay mình sẽ viết một bài hướng dẫn tạo Rich Snippet dạng Breadcum cho website Joomla 1.5.x sau khi làm thì website của bạn sẽ được Google hiển thị như sau :

http://sagalink.net/images/breadcums-joomla.jpg

Cách làm :

1. Bạn mờ file : public_html/modules/mod_breadcrumbs/tmpl/default.php

2. Tìm trong code đoạn mã

PHP Code:

<?php for ($i = 0; $i < $count; $i ++) :

// If not the last item in the breadcrumbs add the separator
if ($i < $count -1) {
if(!empty($list[$i]->link)) {
echo '<a href="'.$list[$i]->link.'" class="pathway">'.$list[$i]->name.'</a>';
} else {
echo $list[$i]->name;
}
echo ' '.$separator.' ';
}  else if ($params->get('showLast', 1)) { // when $i == $count -1 and 'showLast' is true
echo $list[$i]->name;
}
endfor; ?>


và thay bằng đoạn mã :

PHP Code:

<?php for ($i = 0; $i < $count; $i ++) :

// If not the last item in the breadcrumbs add the separator
if ($i < $count -1) {
if(!empty($list[$i]->link)) {
echo '<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="'.$list[$i]->link.'" class="pathway" itemprop="url"><span itemprop="title">'.$list[$i]->name.'</span></a></span>';
} else {
echo $list[$i]->name;
}
echo ' '.$separator.' ';
}  else if ($params->get('showLast', 1)) { // when $i == $count -1 and 'showLast' is true
echo $list[$i]->name;
}
endfor; ?>


Save lại vậy là xong

Để kiểm tra xem bạn đã làm thành công chưa có thể dùng Công cụ kiểm tra đoạn mã đa phương tiện của google (Rich Snippets Testing Tool) check lại : http://www.google.com/webmasters/tools/richsnippets

Nếu hiện ra tương tự như hình tức là bạn đã thành công:

http://sagalink.net/images/test-breadcums.jpg

Việc tiếp theo là bạn chỉ cần chờ cho Google index lại link (re-index) là xong. Chúc các bạn thành công.

Chú ý : Nhớ phải Enable Module Breadcums và hiển thị tất cả các trang nhé
    Blogger Comment
    Facebook Comment