Try our conversational search powered by Generative AI!

Friendly URL API (11.2)


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?

May 03, 2018 11:56

UrlSegment.GetUrlFriendlySegment is obsoleted. Please use IUrlSegmentGenerator.Create(string segment) instead.

May 03, 2018 12:05

are you asking how segment generation works or how to generate url segment for product outside of episerver?

May 03, 2018 12:08

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?

May 03, 2018 12:10

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.

May 03, 2018 14:44

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, and the hierachical url based on UriSegment

You can control their generation by extending UniqueSeoGenerator, and override GenerateSeoUri and GenerateUriSegment, respectively. 

May 03, 2018 14:45

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"

May 03, 2018 14:56

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. 

May 03, 2018 15:09

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 laughing

May 03, 2018 15:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.