Developer forum

Forum » CMS - Standard features » Canonical link in meta

Canonical link in meta

Davor Zlotrg
Reply

Hi DynamicWeb,

I have issues with duplicate canonical rendered on my pages. 

Here is what I have and done so far, and what I want to achieve. We need to have canonical on all pages (content pages, eComm group pages, eComm product pages), even if the Canonical property in Meta section is empty we want SearchFriendlyURL to be shown as canonical.

I have some custom logic in PageTemplateExtender for getting canonical and adding it. So scenario would be, if Canonical meta property is not empty (for content pages, eComm groups, eComm products) use it as canonical, else use PageView.SearchFriendlyURL as canonical.

In the end I just add that canonical with following line of code:

 this.PageView.Meta.Add(String.Format("<link rel='canonical' href='{0}' />", canonicalURL));

I unchecked "Canonical link in meta" checkboxes in Managnent Center -> Web and HTTP -> Customized URLs both in eCommerce and Meta sections. With this setting and custom code for adding canonical in PageTemplateExtender I am trying to achive that only I control adding and rendering of canonical on pages. 

The first issue is that i get 2 same canonicals on product page. You can check on http://195.249.142.64/webshop/bosch-tka8013

The second issue is strange, on frontpage I get 2 canonicals, one from page and other from that bosch product. All screenshoots are attached.

What am I doing wrong? Is there a way to change or remove this.PageView.Meta object (as I saw it is not public, and you can only Add)?

Please advise.

Kind regards,

 

 

Canonical_link_in_meta.PNG frontpage.PNG product_canonical.PNG product_custom_canonical.PNG

Replies

 
Nicolai Høeg Pedersen
Reply

My guess is that your page templat extender is being called twice.

If you totally disable it, does 1 or 0 canonicals appear?

 
Davor Zlotrg
Reply

I disabled page template extender, and now I have 1 canonical on frontpage and product page.

But look at this, on frontpage and product page I got rendered canonical of that product and that is my custom canonical which i typed in Canonical Meta property of product. (See attached)

How is that possible? And also why is canonical rendered at all if "Canonical link in meta" checkboxes in Managnent Center -> Web and HTTP -> Customized URLs both in eCommerce and Meta sections are unchecked?

Kind regards,

 

canonicalDisableExtender-Frontpage.PNG canonicalDisableExtender-Product.PNG
 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

If you specify a canonical on a product, it will always be rendered - no matter your settings. The settings will render automatically calculated canonicals.

The rendering of the product canonical on the frontpage is a bug, TFS#15398 fixed for 8.4.1.12 due tomorrow.

Nicolai

 

Votes for this answer: 1
 
Davor Zlotrg
Reply

Thank you Nicolai. So will wait for that fix. And then in my page template extender will just skip product and product group pages which have canonical in Meta because they will be rendered always (in that way will skip the duplicate ones).

Kind regards,

 
Kristian Kirkholt
Reply

Hi Davor

The problem TFS#15398  has now been fixed in version 8.4.1.12

You are able to find this build in the download section:

http://developer.dynamicweb-cms.com/downloads/dynamicweb-8.aspx

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards

Dynamicweb Support

Kristian Kirkholt

 
Davor Zlotrg
Reply

Hi Kristian and Nicolai,

I downloaded 8.4.1.12 version and the bug was fixed, no more product canonical rendered on frontpage. 

But I found a new one. When you add Canonical property in Meta section on one Product Group it renders correctly on that product group page. But when you navigate to another product group page (which does not have canonical) the canonical is rendered again for previous product group page (on which I added canonical).

Please let me know when this is going to be fixed?
If you need any help with reproducing this please feel free to ask.

Kind regards,

 

 
Nicolai Høeg Pedersen
Reply

TFS#15418, fixed now and out with 8.4.1.13, maybe later this week.

 
Kristian Kirkholt
Reply

Hi Davor

The correction of #15418 "Ecommerce renders canonical for a group when not in group detail view."  has now been completed.
This correction was made in version 8.4.1.13

Please download this from here:

http://developer.dynamicweb-cms.com/Files/Filer/releases/unpublished/Application(8.4.1.13).zip

If you need any additional help regarding this, please feel free to contact the Dynamicweb Support

Kind Regards

Dynamicweb Support
Kristian Kirkholt

 

 

You must be logged in to post in the forum