where to see the "canonical URLs" function work

  • Posts: 103
  • Thank you received: 1
  • Hikashop Essential
11 years 1 day ago #170671

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 2.5.22
-- PHP version -- : 5.3.27
-- Browser(s) name and version -- : google chrome
-- Error-message(debug-mod must be tuned on) -- : where to see the "canonical URLs" function work correctly?

where to see the "canonical URLs" function work correctly?

I already choose "use canonical url if speciied" ,while I don't know how to see this function works well
Because I cann't see canonical code in my products page source codes.
So Can you help me on that?

Thank you very much.

Last edit: 10 years 11 months ago by lechong1.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 18 hours ago #170674

Hi,

It is in the head part of the source code, in a link tag.
You should find it thanks to a search on "canonical".

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

  • Posts: 103
  • Thank you received: 1
  • Hikashop Essential
11 years 12 hours ago #170753

Hi Xavier:
But I never see "canonical" code in my site page's source code.
If I do something wrong?
The only change after use canonical urls is the url of product is unique,regardless of what path I visit this problem,while before the product urls are not stable depends on the visit path.
But I cann't find any "canonical" code in my site's source code.
I think if I cann't see canonical code,the search engines can not see it too.

Jacky

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #170760

Hi,

After reading again your first message, I can see that you have selected the option "use canonical url if specified".
Do you have specified it for each products in the product edition page ?

If not, you can potentially select the value "Use canonical URL and generate it if missing", this way you are sure to have canonical urls.

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

  • Posts: 103
  • Thank you received: 1
  • Hikashop Essential
10 years 11 months ago #170870

Yes I choose the option "use canonical url if specified".
And I specified it for each product in the product edition page,please see the attached picture
Let's take www.open17.com/fluegas/934-afriso-b20 as an example
In this product detailed page,No cononical code found.

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #170881

Hi,

Do you had edited the view "product / show" ?
Thanks to check if the following code is present at the top of the view:

<?php
$canonical=false;
if(!empty($this->element->main->product_canonical)){
	$canonical = $this->element->main->product_canonical;
}elseif(!empty($this->element->product_canonical)){
	$canonical = $this->element->product_canonical;
}
if($canonical){
	$doc = JFactory::getDocument();
	$doc->addCustomTag( '<link rel="canonical" href="'.hikashop_cleanURL($canonical).'" />' );
}
?>

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

  • Posts: 103
  • Thank you received: 1
  • Hikashop Essential
10 years 11 months ago #171002

Thank you very much Xavier,
I add the codes you provide to product/show,
Is the position right?
Now I can see "cononical" in page source code.

Attachments:

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
10 years 11 months ago #171028

That's why you didn't saw the canonical URLs on your pages ! You are using a view override from HikaShop 2.0.0 (see the version tag at the beginning of the file) where the canonical URL function did exist.

Yes, that's the correct place.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum