Issue ith canonical URLs

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355658

-- url of the page with the problem -- : rolex.jewelrygoldfinger.com/collection
-- HikaShop version -- : 5.0.0
-- Joomla version -- : 4.3.4
-- Browser(s) name and version -- : 8.1

Hi,

I just noticed I have an issue with canonical URLs.
I set them up for all category and products, in both languages but they appear in the source code only for some.

For example:
- it's ok on this page: rolex.jewelrygoldfinger.com/collection/1908/m52509-0006
- It's not present on this page: rolex.jewelrygoldfinger.com/collection/l...atejust/m279174-0020

Any idea what I may have done wrong?

Thanks for your help.

Sandra

Last edit: 1 year 2 months ago by Sandra74.

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

  • Posts: 4760
  • Thank you received: 647
  • MODERATOR
1 year 2 months ago #355660

Hello,

Can you provide your relative product settings screenshots (for both of your previous product example) AND the relative category setting.
Regards

Last edit: 1 year 2 months ago by Philip.

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355680

Hi Philip,

Thanks for your answer.

I enclose the screenshots.

Thanks in advance for your help

Sandra

Attachments:

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355711

Hi,

HikaShop adds the canonical URL to the product page with the code:

if(!empty($this->canonical)) {
	$doc = JFactory::getDocument();
	$doc->addHeadLink(hikashop_cleanURL($this->canonical), 'canonical');
}
at the beginning of the product / show view file, which you can edit via the menu Display>Views.
It could be that you have a view override which only runs that code in some cases, instead of running it for all the products. Do you have any view override for it ?
Or it could be that there is a system plugin which unsets the metadata tag for some reason ( a SEO plugin, or Falang, or something like that ). Are you using any ?

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355712

Hi Philip,

I haven't edited the show.php file and I'm not using any SEO or Falang extensions.

I have 2 other sites set up in the same way, displaying the same products, on which canonicals URLs work as expected.
The main difference is that Goldfinger site is available in 2 languages,, the 2 others are only in en-US.

Sandra

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355714

Hi,

Then I don't know why it's doing that. Please provide a backend access via our contact form and we can have a deeper look at the situation.

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355726

Credentials sent.

Thanks!

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355731

Hi,

Thanks. I've checked the situation but I don't know what's going on.
The code I pointed out in my message is properly called and the canonical URL there is proprely provided to Joomla to add the canonical meta tag in the headers of the page.
So I can only think that somthing else is removing it from the headers for some reason.
However, I checked your components and plugins and I couldn't find what could do that.

One clue I found is that if I add the parameter tmpl=component to the URL (which means that the product page displays without the template and modules around it, it properly has the canonical meta tag:
i.imgur.com/aNg7ROx.png
So this points to the template being the culprit.
I wanted to try temporarily switching to the default template of Joomla, in order to confirm whether the page displays with the canonical tag with the default template, but I can see you removed it from your website so I couldn't perform the test.

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355747

Hi Nicolas,

The core template is just disabled in the extension manager. I did a test with the core template but the issue remains.
I'm using the same template and same extensions on the 3 sites. I really don't know what's going on and I really need them to work.

Sandra

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355748

I found what is causing the issue.
It's multilingual.
If I disable multilingual (in Hikashop and in the core), then the canonical URLs are back and works as expected.
Hope it can help you.

Sandra

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355751

Hi,

How did you "disable multilingual (in Hikashop and in the core)" exactly ?
I checked your website and I still don't see a way to switch temporarily to the default template of Joomla in order to test this. Could you provide precise instructions on how to test this ?

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355799

Hi,

Sorry for my late answer, I didn't receive the message notification

I did my tests on a copy of the site. If I disable completely multilingual on the production site, then I can't re-enable it without losing some data in Hikashop. On the copy of the site, I disabled multilingual in Hikashop and disabled the 3 core plugins and discovered that it allows canonical URLs to work.

To switch of template, you need to enable the core template in the extension manager, and then assign it to lady-just collection for example.
Note that the canonicals URLs of pages outside hikashop work fine with the template (and they work fine on Hikashop pages on the other sites unsing the same template)
If you want, I can grant you an access to the staging site

Sandra

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355800

Hi,

It would be great, yes, if you could provide access to the staging website. That way, I could run further tests.
Could you also mention which 3 core plugins you disabled ? What if you disable the plugins but leave the multilingual turned on in HikaShop ? Do you have the issue ?

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355811

Hi Nicolas,

I think I may have found which option is causing the issue.

In the System – Language filter plugin if you enable “Add alternate meta tags”, then the canonical tag disappears (and I need this option to be enabled).

With my test, I enabled:
- Hikashop multilingual
- In modules, Language switcher module
- In the extension manager:
o language swither
o SyStem – Language code
o System – Language filter

I send you an access to the test site.

Thanks

Sandra

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355838

Hi,

It seems to be a problem in the Joomla language filter plugin.
The "hreflang" tag added for the en-US language on this page has the same href as the canonical tag added by HikaShop.
Because of this, it overwrites HikaShop's canonical tag.
However, I don't think it should add a hreflang tag for the current language. The plugin should only add the tag for other languages than the current one. For example, on moz.com/learn/seo/hreflang-tag it provides an example of a spanish language page, with alternate tags for portuguese and french but not for spanish.

I think either of two things should be done:
- In the language filter plugin, the line:

$language->link = Route::_($currentInternalUrl);
should be changed to :
unset($languages[$i]);
in order to not add an alternate tag for the current language

- In the Document class of Joomla, the meta tag links are stored based on their URL only. So if two different extensions want to add a link meta tag with the same URL but for different purposes, they can't, only the last one will be taken into account, like here. I don't know if it would be interesting to change the Document class to store the links based on both the URL and the relation parameter in order to give more flexibility.

I'll post an issue on the Joomla github.

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355839

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355844

Thanks a lot Nicolas!

Hope they will solve this issue.

Sandra

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355845

I edited the plugin like you mentioned.
Canonical URLs are back, but then alternate tag disappears completely.

Sandra

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 2 months ago #355848

Then another modification might be necesssary.
Note that I'm not familiar with the code in the Language Filter plugin. I only proposed that change after a quick look into it.

Are you sure you changed the line I said and not this one ?

$language->link = Route::_($cassociations[$i]);

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

  • Posts: 159
  • Thank you received: 12
  • Hikashop Business
1 year 2 months ago #355855

Good morning Nicolas,

Yes, I changed the right line (by copying the line to change and using the search and remplace function of Brackets).

Wishng you a great day

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

Time to create page: 0.092 seconds
Powered by Kunena Forum