Developer forum

Forum » Development » Code behind friendly URL

Code behind friendly URL

Martijn Bokhove
Reply
Hi

Is it possible to use eCommerce.Products.Product.MetaData() to get the friendly URL from a product?

We're trying to add a canonical for productdetailpages with the friendly URL from the product.
In normal cases the customer loads the page with the friendly URL, like webshop.com/products/myproduct.aspx
But it's also possible to show the page with parameters, like webshop.com/default.aspx?ID=1&ProductID=1

We would like to add a canonical so in both situations, with friendly URL and with the parameters, always the same friendly URL shows up in the canonical, so Search Engines will index (only one and) the correct URL and don't see it as duplicate content.

Is it possible what we are trying to achieve?

Gr
Martijn

Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer
You can just do like this:
Dynamicweb.Frontend.SearchEngineFriendlyURLs.getSearchFriendlyUrl("Default.aspx?ID=12&GroupID=34&ProductID=Prod1")

Votes for this answer: 0
 
Martijn Bokhove
Reply

Hi Nicolai

That's a wunderfull function!
Work's great.

Thanks

Gr
Martijn

 

You must be logged in to post in the forum