Friendly URL API (11.2)

Vote:
 

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?

#191968
May 03, 2018 11:56
Vote:
 

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

#191971
May 03, 2018 12:05
Vote:
 

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

#191972
May 03, 2018 12:08
Vote:
 

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?

#191974
May 03, 2018 12:10
Vote:
 

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.

#192014
May 03, 2018 14:44
Vote:
 

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. 

#192015
May 03, 2018 14:45
Vote:
 

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"
    }
  ],

#192016
May 03, 2018 14:56
Vote:
 

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. 

#192019
May 03, 2018 15:09
Vote:
 

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

#192021
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.