Using snippets to enhance search engine listings

Rich snippets are an enhanced way of providing information about the type of content on your website to search engines.

For example, rich snippets can allow search engines such as Google to display product ratings on the search engine results page, such as the Google search engine listing for a product on www.lego.com highlighted at the bottom of the following screenshot (below the paid advertisements):

Using snippets to enhance search engine listings

Rich snippets on the website allow Google to display the star rating for the product alongside the overall rating and number of reviews.

Tip

For more information on rich snippets, visit https://support.google.com/webmasters/answer/99170.

To implement the ratings-rich snippet, copy the summary.phtml file in the app/design/frontend/base/default/template/review/helper/ folder to app/design/frontend/default/m18/template/review/helper/, and open it to include the following highlighted code:

<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<?php if ($this->getReviewsCount()): ?>
<meta itemprop="ratingValue" content="<?php echo $this->getRatingSummary(); ?>"/> 
<meta itemprop="reviewCount" content="<?php echo $this->getReviewsCount(); ?>" />
<meta itemprop="worstRating" content="0"/>
<meta itemprop="bestRating" content="100"/>
<div class="ratings">
<?php if ($this->getRatingSummary()):?>
<div class="rating-box">
<div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%"></div>
</div>
<?php endif;?>
<p class="rating-links">
<a href="<?php echo $this->getReviewsUrl() ?>"><?php echo $this->__('%d Review(s)', $this->getReviewsCount()) ?></a>
<span class="separator">|</span>
<a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Add Your Review') ?></a>
</p>
</div>
<?php elseif ($this->getDisplayIfEmpty()): ?>
<p class="no-rating"><a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Be the first to review this product') ?></a></p>
<?php endif; ?>
</div>

Save this file to your Magento store's theme and your rich snippet is ready to go.

Tip

Remember, including the preceding code is only a request for search engines to display this information in their results list, and they might not necessarily use this.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset