UrlSegment.GetUrlFriendlySegment is obsoleted. Please use IUrlSegmentGenerator.Create(string segment) instead.
are you asking how segment generation works or how to generate url segment for product outside of episerver?
Yes Valdis
Do you know if there is an equivalent function in .NET somewhere, or is it a customer function in Episerver?
Are there other possibities from Service API?
I'm not sure about equivalent methods in .NET. I can help summarizing how segment generation works. We have default implementation and it can be customized.
About ServiceAPI, I did a quick check and not found much relating to segment.
I'm not sure what part are you mentioning. There are two ways to "link" to a catalog item - by Seo URL, so it'll be https://yoursite.com/this-is-the-product, and the hierachical url based on UriSegment https://yoursite.com/catalog/category/subcategory/the-product.
You can control their generation by extending UniqueSeoGenerator, and override GenerateSeoUri and GenerateUriSegment, respectively.
I am inserting products via API /episerverapi/commerce/entries
I then need to set these 2 values (see json), but i what to make sure that they are valid as friendly urls and valid to Episerver, as i cant use internal function IUrlSegmentGenerator.Create from API. So im am just looking for guidens on how you parse a string to url in the function IUrlSegmentGenerator.Create, so I can do the same.
I am thinking som Regex.Replace ?
"SeoInformation": [
{
"Title": "",
"Uri": "Jackets-Peacoats-Hooded-Tan-Small.aspx",
"UriSegment": "Jackets-Peacoats-Hooded-Tan-Small",
"Description": "",
"Keywords": "",
"LanguageCode": "en"
}
],
As I said you need to create you own implementation of UniqueSeoGenerator and override the default one. ServiceAPI is still a Commerce site, so you can just add your assembly their with your class and registration.
If you leave Uri and UriSegment to be empty, you will most likely be able to control the generation of them from the method you overriden.
I think i get what you are saying :-)
But im not a Episerver Developer, but a Dynamics NAV developer.
I will take it up with our Episerver partner.
Thanks guys
We are discussing if we should control URL on products from ERP, as we would like it to consist of more information than name and language, as Episerver creates by default.
But what is the function UrlSegment.GetUrlFriendlySegment based on in .NET if I need to generate Friendly URL outside of Episerver?