Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7873783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:36:48+00:00 2026-06-03T02:36:48+00:00

I’m working on a multi-language solution in Sitecore and want to use the DisplayName

  • 0

I’m working on a multi-language solution in Sitecore and want to use the DisplayName property of an item to represent the URL to allow for language-specific URLs.

I’ve set the useDisplayName web.config property to true as shown below

<linkManager defaultProvider="sitecore">
  <providers>
    <clear />
    <add name="sitecore" 
         alwaysIncludeServerUrl="false"
         encodeNames="true"
         type="Sitecore.Links.LinkProvider, Sitecore.Kernel"
         addAspxExtension="false"
         shortenUrls="true"
         languageEmbedding="asNeeded"
         languageLocation="filePath"
         useDisplayName="true" />
  </providers>
</linkManager>

I’ve also been playing with the <encodeNameReplacements> section which can replace %20 with a hyphen in the URL to give nice clean URLs – this is done with the following for those who are interested:

<replace mode="on" find=" " replaceWith="-" />

All very good, except that Sitecore breaks if a user enters a hyphen within a DisplayName with the above setting turned on…. If I turn the above setting off, then I have to ensure that users enter nice hyphen separated values for the DisplayName otherwise we start seeing nasty %20s again in the URL…

So, is there a way to validate the DisplayName property to either disallow or allow hyphens being used?

Or, even better, is there a way to hook into whatever code is executed when the encodeNameReplacements thing happens? This would be ideal, as I could allow users to enter whatever they like for DisplayName, then just sanitise this value on the fly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:36:50+00:00Added an answer on June 3, 2026 at 2:36 am

    There is a solution for this, but it will require some coding and it’s quite complex.
    I have used this kind of solution in many projects before and it’s the only way of solving this, that i’m aware of.

    You don’t want to really replace spaces with hyphens when saving the item, because it’s not user friendly.
    My solution works at runtime.

    First get rid of the <replace> rule you added.

    Then create your own LinkProvider (inherit from Sitecore’s default provider).
    Inside the LinkProvider create a method to “normalize” the item’s displayname (e.g. replace spaces for hyphens), let’s call this method NormalizeDisplayName(). Make it public and static cause you will need it later.

    So now you have managed to let Sitecore replace all spaces with hyphens in links. The rest you can still configure using the default provider options (addAspxExtension=”false” useDisplayName=”true”, etc)

    Next up is the ItemResolver: Sitecore’s default ItemResolver is not going to recognize the item path anymore so you are going to add your own ItemResolver to fix this.

    Create a class that inherits from Sitecore.Pipelines.HttpRequest.HttpRequestProcessor and configure it to be used in the <httpRequestBegin> pipeline after the default ItemResolver.

    Now, when the itemresolver is processed you will first split up the requested itempath (let’s assume that “/category-name/subitem-name” was requested).
    Starting from the siteroot (which can be pulled from Sitecore.Context.Site), loop through all children while normalizing their item names using your NormalizeDisplayName() method you created earlier, until you find one that matches the part of your item path.

    So in this case, loop through the children of your Home item until you find one that matches normalized displayname “category-name”. Then do the same thing for the children of that item until you find the item with normalized displayname “subitem-name”.

    This way you can resolve the requested item and it will also work if the original displayname already contained hyphens!

    I’m sorry that I can’t give you complete code examples as it’s quite complex and is not limited to just the above things. You also need to think about redirecting if the URL is not properly formatted and make exceptions for master/core database to prevent Sitecore from breaking.

    Hope this helps you!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
i want to parse a xhtml file and display in UITableView. what is the
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.