Canonical urls

  • Posts: 5
  • Thank you received: 0
11 years 7 months ago #98955

Hi. Thanks for adding the canonical URL feature for categories in 2.1.2 and the existing product feature. Just a question regarding how it manifests on the site. I believe, the canonical URL tag would not have to show in the html on the canonical url html - but on the non-canonical urls - directing back to the canonical one. In my case I am using SH404 and while I can add canonical urls through this, I cannot see any tags appearing using the Hikashop canonical setup. If I add canonical urls using Hikashop then existing SH404 canonical url tags also then disappear. Hikashop canonical information is appearing in the hikashop product data base table.

Should the Hikashop canonical system add html tags into html pages or does it work on the backend in some fashion with spiders?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 7 months ago #99012

Hi,

HikaShop add the canonical URL on the product page itself. There is no interaction with SEF extensions on that end.
Then, maybe SEF extensions are intelligent enough to not add the canonical tag to the pages if there is already one added before.

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 7 months ago #99091

Thanks Nicolas. With a little more experimentation the point is if SH404 is turned on then the Hikashop entered canonical urls will not be displayed. If there is a value in the data base for the Hikashop url then neither the Hikashop or SH404 canonical URL will be displayed. If the Hikashop value is removed from the database then the SH404 entered canonical value will be displayed on the page html.

Seems like a compatibility issue with SH404.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 7 months ago #99112

Can you give a URL of a product page with the canonical URL entered in HikaShop and SEF activated ?

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 7 months ago #99152

Tks, here they are. SH404 activated (but no canonical ul given),canonical urls given in Hikashop for category and product (the same as listed here)

douglaschain.com.au/miners-belts/category

douglaschain.com.au/miners-belts/product/414-miners-belt

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 7 months ago #99341

It could potentially be that you edited the "show" file of the view "product" before updating HikaShop and because of that, you didn't get the modifications for canonical URLs.
In that case, you would have to add the code in it via the menu Display->Views yourself:

<?php
if(isset($this->element->product_canonical) && !empty($this->element->product_canonical)){
	
	$parsedCanonical = parse_url($this->element->product_canonical);
	$parsedCurrent = parse_url(JURI::base());
	
	if(!isset($parsedCanonical['query']))
		$endUrl = $parsedCanonical['path'];
	else
		$endUrl = $parsedCanonical['path'].'?'.$parsedCanonical['query'];
	
	$canonicalUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$endUrl;

	$doc =& JFactory::getDocument();
	$doc->addCustomTag( '<link rel="canonical" href="'.$canonicalUrl.'" />' );
}
?>
or remove your customization.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum