Sunday, January 24, 2016

Sitecore 8.1 encode name replacements

<encodeNameReplacements>

In Sitecore 8.1 you will find an extra entry in the <encodeNameReplacements> section of the Sitecore config (now located in /App_Config/Sitecore.config): 
<replace mode="on" find=" " replaceWith="-" />

This addition will replace all spaces in the generated urls (so either in display name or name) with a '-'.  Looks very nice, our seo-friends happy, but...

Two issues have been noticed which you might need to tell your editors about:

1. Items with a " " and a "-" in the (display) name

Our editors created several items with both characters in the name.. they all resulted in a 404 page because the item could not be resolved by Sitecore. Two ways to handle this:
- turn off the replacement
- tell your editors not to do that (optionally create a rule with a regular expression to validate item names)

We went for option 2..  


2. Wildcard items

When you have a wildcard item in a folder (item named "*") this replacement will give additional issues..  As soon as you create an item with a space in it, it will not be found and directed to the wildcard instead. Apparently the check for wildcards is done before the handling of replacements which causes this behavior. 

There is a support fix available for this (452602 - patching the ItemResolver), but another (and maybe easier) way of handling it is not using spaces in folders with wildcard items.


That is for now - tell your editors to avoid getting (a lot of) bug reports for broken urls ;)

Update

Apparently the issue(s) has been fixed in Sitecore 8.1 Update 2 (see http://sitecorefootsteps.blogspot.be/2016/03/item-url-replacement-improvements.html)