More of a request than anything as its the way the Kentico urls are cleaned internally is really ugly
having urls such as /Hotels--Spas
from the document name of "Hotels and Spas" really grinds my gears.
What would be nice is /Hotels-and-Spas
See code below for example on how to generate them
/// <summary>
/// Will convert the string (name) to a url friendly version.
/// Also see UriHelper.GenerateSlug(...)
/// e.g.
/// Example Name => example-name
/// Example& Name => exampleand-name
/// Examplé-test-Name => example-test-name
/// ExamplÅ Name => exampla-name
/// Example Name... => example-name
/// Example & Name! => example-and-name
/// Example & Name! => example-and-name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static string GenerateFriendlyName(string name)
{
// 1. Convert to base letters e.g. é = e, Â = A
string str = RemoveDiacritics(name);
// 2. Once converted, make lowercase
str = str.ToLower();
// 3. Decode (incase html) e.g & = &, © = ©
str = HttpUtility.HtmlDecode(str);
// 4. Since '&' will be removed, we instead want to convert to base letters
str = str.Replace("&", "and");
// 5. Replace invalid chars with spaces
str = Regex.Replace(str, @"[^a-z0-9s-]", " ").Trim();
// 6. Convert multiple spaces/hyphens into one space
str = Regex.Replace(str, @"\s+", "-");
str = Regex.Replace(str, @"-{2,}", "-");
return str;
}