Hello,
I think by default VM 3 use relative canonical URL as /category/sub-categoty/product-detail.
My question how to add http://your-website.com/ to canonical URL to have an absolute URL.
I'm OK with categories and sub-categories. I did some adjustment (advice from VM forum) but I can't figure out how to adjust product page.
So, absolute URL for product has to be as http://website.com/category/sub-category/product-detail but now is /category/sub-category/product-detail.
Please any solution or advice.
P.S. Also my K2 Items are missed canonical URL at all. Only base href. Why?
Thanks
Hello
I do the same on my website
-->in components/com_virtuemart/views/category/view.html.php ligne 344/5/6 :
if($categoryId!==-1){
$link .= '&virtuemart_category_id='.$categoryId;
}
if($manId!==-1 && $manId >=1){
$link .= '&virtuemart_manufacturer_id='.$manId;
}
$document->addHeadLink('http://www.mydomain.com'.JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
}
-->in components/com_virtuemart/views/productdetails/view.html.php ligne 223 :
$document->addHeadLink('http://www.mydomain.com'.JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
} else {
$document->addHeadLink('http://www.mydomain.com'.JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
}
imho it is enough to change JRoute::_($link, FALSE) to JRoute::_($link, true)
Quote from: -Tony- on June 09, 2015, 13:12:38 PM
Hello
I do the same on my website
-->in components/com_virtuemart/views/category/view.html.php ligne 344/5/6 :
if($categoryId!==-1){
$link .= '&virtuemart_category_id='.$categoryId;
}
if($manId!==-1 && $manId >=1){
$link .= '&virtuemart_manufacturer_id='.$manId;
}
$document->addHeadLink('http://www.mydomain.com'.JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
}
-->in components/com_virtuemart/views/productdetails/view.html.php ligne 223 :
$document->addHeadLink('http://www.mydomain.com'.JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
} else {
$document->addHeadLink('http://www.mydomain.com'.JRoute::_($link, FALSE) , 'canonical', 'rel', '' );
}
you do you have to hard code your domain
for category
$document->addHeadLink(JRoute::_($link, true, -1), 'canonical', 'rel', '');
THE -1 adds the base
I have learned several things today, thanks ;)