3

I have a multi language site and one language is german. I need language specific urls and so I am using the display name to generate the url and to show the Page titels and linknames to the internal pages.

And in German the "About Us" page is called "Über uns" and here the generated url is "über-uns" and has a "mutated vowel" in it and I don't want this it should be this url "ueber-uns".

I know that mutated vowel are allowed in an url but I don't want to use it :-) is there a config I can use?

3
  • Do you use Display Names for anything else than url generation? Mar 2 '19 at 22:38
  • @MarekMusielak Yes I would like to use it for Page Titel and Link names, when I create an internal link Mar 2 '19 at 22:39
  • You'll need a custom LinkProvider for this
    – Mark Cassidy
    Mar 3 '19 at 11:44
5

In general, when using the out of the box functionality and fields , you can specify the display name to any value you like for the URL. It appears you have already configured your Link Provider to use display names so that part is done.

A common approach would then be to introduce a Page Title field. It is very common that the text for a title may not match the URL. For example, you may not want to have special characters like & in the URL, but this may be in a title such as 'Location & Hours'.

If you do not want to add a Page Title field you will need to add a custom provider to programmatically convert your list of undesired characters to your desired replacements. Adding a Page Title field is likely less risky and less effort.

1
  • that sound good you are right the "&" is one more thing where I have to make a exception. So an alternate field would be a good idea and more flexible Mar 3 '19 at 17:33
1

I would suggest to use the encodeNameReplacements in the web.config

This is the default set:

<encodeNameReplacements>
  <replace mode="on" find="&amp;" replaceWith=",-a-," />
  <replace mode="on" find="?" replaceWith=",-q-," />
  <replace mode="on" find="/" replaceWith=",-s-," />
  <replace mode="on" find="*" replaceWith=",-w-," />
  <replace mode="on" find="." replaceWith=",-d-," />
  <replace mode="on" find=":" replaceWith=",-c-," />
</encodeNameReplacements>

And you can add yours, like:

  <replace mode="on" find="ü" replaceWith=",ue," />

Some more information on this:

https://briancaos.wordpress.com/2017/12/08/sitecore-replace-spaces-with-dashes-in-urls/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.