Developer forum

Forum » Ecommerce - Standard features » Canonical link for Groups in Rapido based solutions

Canonical link for Groups in Rapido based solutions

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys, 

I know this is a very hot topic with a lot of flavors. 

I have a new issue s and I have no idea how to solve it.

I have a solution running on DW 9.13.8 and a Customized Rapido implementation.

The problem I have is the canonical link for Groups. Or to be more accurate, the lack of.

I have checked the settings here:

And here (GlobalSettings):

I have set Primary page for group and Canonical value:

I have configured the paragraph (both with and without  "Use first page.." and "Show on paragraph"):

But no matter what I do, there is no canonical info displayed on the Group page.

If I set a canonical value on the products page, it is displayed on the Group page. But without any canonical information from the group.

I am running out of ideas and I feel that I am still missing something.
Does anybody have any ideas or pointers? There are a few other posts on the forum but most of them point to links that are inactive anymore.

Thank you,
Adrian


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Well - originally canonicals was only inserted if the URL you were on, did not match the calculated canonical. Which is one of the points of canonicals. But average people does not understand, so that has been changed later. Cannot remember when.

Also canonicals at some point was also only inserted if a unique URL could be determined - another very important point of canonicals - and yet another thing that is hard to understand. So if a product is in 2 groups, it will not show a canonical if one of those groups are not primary - and there is a clear path all the way to the top.

My guess is that you are running into number 1 above maybe?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Here is the code that creates the canonical - you might be able to use that:

var primaryGroup = product.GetDefaultGroupByShopId(shopId);
int pageid = renderingContext.CurrentPageView.ID;

 if (primaryGroup.PageIdRelation > 0)
 {
 pageid = primaryGroup.PageIdRelation;
 }

 canonical = $"Default.aspx?ID={pageid}&GroupID={primaryGroup.Id}&ProductID={product.Id}";
 string domain = Context.Current.Request.Url.DnsSafeHost;

 if (!string.IsNullOrEmpty(renderingContext.CurrentPageView.Area.DomainLock))
 {
 domain = renderingContext.CurrentPageView.Area.DomainLock;
 }

 string absoluteCanonical = $"{(Context.Current.Request.IsSecureConnection ? "https://" : "http://")}{domain}{SearchEngineFriendlyURLs.GetFriendlyUrl(canonical)}";
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I am not sure which is my case :)

Since I am talking about Group canonicals, the link to the Group is always unique (my groups are always assigned to a single parent). I understand the explanation about the reason for disolaying the canonical ONLY if it's different than the current link, but you are well aware that SEO "experts" have a different opinion about it and they use canonical information to manipulate link relevance. Not documented officialy but still a practice.

However, in my case the missing part is using the value set custom in the canonical field on the Group.

For example, if I have this link: https://dev.nobilacasa.dotfusion.ro/arta-mesei-si-bucatarie/servire-bauturi/pahare and on the group "pahare" I set a custom canonical value, the canonical and the link would be different and the custom one should be displayed.

After opening this thread, I have made another test and I have added in the ProductList page another paragraph with the "ProductCatalog for View Models" App. And all of the sudden, the canonical shows up. Not the custom one though.

Apparently, the product catalog module has a saying in how the canoncal is handled.

My customer expects that the canonical field from the group would be honored. Which means that I cannot charge them for custom development to handle a standard scenario. That's why I am struggling to understand why is it not working.

Thank you,

Adrian

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

I think the issue here is that the list is rendered using headless - so the actual list is coming from another page and being rendered client side.

And that is why it works when you add the catalog for viewmodels to the paragraph list - because it works differently and handles canonicals not as part of rendering (like the old produc catalog module) but as part of the module initialization.

So - there is not an easy fix here. It is a consequence of the Rapido implemenation using feeds/headless-ish templates.

In order to trigger canonicals in this case, you need to trigger a group rendering - so the list template need to render 'something' - which it does not when setup in feed mode.

So I actuall think the only solution is to insert a dummy paragraph with the old product catalog module in list module.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,
We already have the old product catalog on the page.

The Feed request is to the same page with the &feed=true parameter. That's why I am a bit confused.

Adrian

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

When you have selected a productlist feed template, the regular product list is not rendered. That is why the canonical is not there.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Ok.

I will use a fake ProductCatalog Module if it solves the issue.
Will test and get back.

Thank you,
Adrian

 

You must be logged in to post in the forum