News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

General Canonical link question

Started by Meton, November 09, 2015, 10:30:43 AM

Previous topic - Next topic

Meton

I feel kinda dumb but ill ask this anyway.

When you setup the canonical link for you category's the canonical link states:

URL/categoryname

When you move to page 2 via the url changes to:
URL/categoryname?start=18

When you look at your canonical it will still state the orginal: URL/categoryname that means that te products on the second or third page will never get indexed am i right?

If thats correct, is a canonical really needed in the category view?

Kind regards,

Meton

Joomla!         3.6.5
VirtueMart     3.0.18

-Tony-

It is not exactly that.
The category does not appear in the serps for keywords present in the other pages because they are considered duplicate content
However, the products appear coming and will be indexed because they are accessible.

http://forum.virtuemart.net/index.php?topic=131239.0

http://googlewebmastercentral.blogspot.fr/2011/09/pagination-with-relnext-and-relprev.html

Meton

Quote from: -Tony- on November 09, 2015, 11:55:30 AM
It is not exactly that.
The category does not appear in the serps for keywords present in the other pages because they are considered duplicate content
However, the products appear coming and will be indexed because they are accessible.

http://forum.virtuemart.net/index.php?topic=131239.0

http://googlewebmastercentral.blogspot.fr/2011/09/pagination-with-relnext-and-relprev.html

This was exactly what i was looking for, google understands that ?start=18 is the same page! Cheers m8
Joomla!         3.6.5
VirtueMart     3.0.18

-Tony-

#3
Yep he understand well.
I've improve my little think before, he must be adapted for any case, not copy and paste, and that's not a "clean" solution (clean code and integration).
But the result is clean for me.

Category/default.php (after unset canonical on category/view.html.php) :



$document = JFactory::getDocument ();
$pagdata = $this->vmPagination->getData();
$next = JRoute::_($pagdata->next->link);
$prev = JRoute::_($pagdata->previous->link);
$prev=str_replace( '?limitstart=0', '', $prev);
$prev=str_replace( '&limitstart=0', '', $prev);
$monUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$monUrl=str_replace( '?error=404', '', $monUrl);
$monUrl=str_replace( '?limitstart=0', '', $monUrl);
$monUrl=str_replace( '&limitstart=0', '', $monUrl);
$monUrl=str_replace( '?limit=200', '', $monUrl);
$monUrl=str_replace( '&limit=200', '', $monUrl);
$monUrl=str_replace( '&start=800', '', $monUrl);
$monUrl=str_replace( '?start=800', '', $monUrl);
$monUrl=str_replace( '?limit=20', '', $monUrl);
$monUrl=str_replace( '?limit=40', '', $monUrl);
$monUrl=str_replace( '?limit=80', '', $monUrl);
$monUrl=str_replace( '&limit=20', '', $monUrl);
$monUrl=str_replace( '&limit=40', '', $monUrl);
$monUrl=str_replace( '&limit=80', '', $monUrl);
$monUrl=str_replace( '&start=20', '?start=20', $monUrl);
$monUrl=str_replace( '&start=40', '?start=40', $monUrl);
$monUrl=str_replace( '&start=60', '?start=60', $monUrl);
$monUrl=str_replace( '&start=80', '?start=80', $monUrl);
$monUrl=str_replace( '?dir=DESC', '', $monUrl);
$monUrl=str_replace( '&dir=DESC', '', $monUrl);
$monUrl=str_replace( '?orderby=product_price', '', $monUrl);
$monUrl=str_replace( '&orderby=product_price', '', $monUrl);
$monUrl=str_replace( '?orderby=product_name', '', $monUrl);
$monUrl=str_replace( '&orderby=product_name', '', $monUrl);
$monUrl=str_replace( '&Itemid=478', '', $monUrl);
$monUrl=str_replace( '/fournisseur?categorylayout=0&showcategory=1&showproducts=1&productsublayout=0', '', $monUrl);
$monUrl=str_replace( '?categorylayout=0&showcategory=1&showproducts=1&productsublayout=0', '', $monUrl);
$monUrl=str_replace( '?categorylayout=0&filter_product=', '', $monUrl);
$monUrl=str_replace( '?filter_product=', '', $monUrl);
$monUrl=str_replace( '?categorylayout=0', '', $monUrl);
$monUrl=str_replace( '&filter_product=', '', $monUrl);
$monUrl=str_replace( '/fournisseur/', '', $monUrl);

if (empty($this->keyword)) {$document->addHeadLink($monUrl, 'canonical', 'rel');}

if (preg_match("#Itemid|recherche|category|fournisseur|filter|&start=|keyword|limitstart|orderby|limit|par,prix|par,produit|par,categorie|results|DESC|Desc|productsublayout#", $_SERVER['REQUEST_URI']) == false){
if (empty($this->keyword) && ($pagdata->next->link)){$document->addHeadLink($next, 'next', 'rel');}
if (empty($this->keyword) && ($pagdata->previous->link)){$document->addHeadLink($prev, 'prev', 'rel');}
}



logic.php of my template :



$document = JFactory::getDocument();
if (preg_match("#users|error|component|Itemid|recherche|category|fournisseur|filter|keyword|limitstart|orderby|contact|legales|conditions|limit|par,prix|par,produit|par,categorie|results|DESC|Desc|notify|feed|index.php|undefined|tmpl|PageSpeed|productsublayout#",$_SERVER['REQUEST_URI'])){$document->setMetaData( 'robots', 'noindex, follow' );}