Duplicate content in K2

k2-seo

K2 Component for Joomla allows us an advanced management of our items by adding extra functionality not available in the content management system Joomla. The problem comes when Google webmaster tools to warn us that this component is creating duplicate content, then explain the solution to the problem.

You have to modify some code from K2 template files, it is recommended to make a good document or override changes are to be made to avoid problems in future updates of the component.

For items of K2 must components/com_k2/templates/default/item.php modify the file add the following code:

<?php
if ($this->item->link!= JRequest::getURI()) JApplication::redirect($this->item->link,'','' ,true);
?>

For the categories of K2 have to modify the file components/com_k2/templates/default/category_item.php add the following code:

<?php
$this->original_link = JRoute::_(K2HelperRoute::getCategoryRoute(JRequest::getVar('id'),
0));
if (JRequest::getInt('start') > 0) $this->original_link .= "?start=" . JRequest::getVar('start');
$this->real_link = JRequest::getURI();
if ($this->original_link != $this->real_link) JApplication::redirect($this->original_link,'','' ,true);
?>
These changes redirect all duplicate url’s to a single URL.

If you have installed the Xmap Sitemap component Generartor also have a problem with the URL’s of K2, to solve it you have to make a few small changes to the code of Xmap plugin for K2.

We have to modify the file com_k2.php normally found in the directory plugins/xmap/com_k2.

Change the following line, which is in about 317:

$node->link = 'index.php?option=com_k2&view=itemlist&task=category&id='.$row->id.':'.$row->alias;

To

$node->link = 'index.php?option=com_k2&view=itemlist&task=category&id='.$row->id.':'.$row->alias . '&Itemid=' .$parent->id;

For url’s of the categories, change the following line, which is in about 323:

$node->link = 'index.php?option=com_k2&view=item&id='.$row->id.':'.$row->alias;

To

$node->link = 'index.php?option=com_k2&view=item&id='.$row->id.':'.$row->alias . '&Itemid=' .$parent->id;

If we want Google not to index K2 tags, which are cosideradas duplicate content as we add the following line to your robots.txt file:

Disallow: */itemlist/tag/*

Performing these actions improve the SEO of our website with Joomla! and K2.

Llamar a Doowebs Teléfono de Doowebs 653836347