Ths setting we are going to discuss is
<!-- ITEM NAME ALLOW MIXING REPLACEMENT CHARACTERS
Specifies whether you can create items with names that contain the values defined in the 'find' and 'replaceWith' properties in the
'encodeNameReplacements' section.
Default value: true.
-->
<setting name="ItemNameAllowMixingReplacementCharacters" value="true"/>
Early versions of Sitecore (earlier than 8.1 Update-2), if you have define character replacements for url's and want to include both parts 'find' and 'replaceWith' from 'encodeNameReplacements' section, Sitecore failed to process the URL and find a matching item to serve.
for example,
- you have defined following setting in <encodeNameReplacements> section
<replace mode="on" find=" " replaceWith="-" />
- and you have created an item with following name under /sitecore/content/home
"sample item-1" (please note both space ('find' part) & hyphen ('replaceWith' part)
- Sitecore generates above item url as http://hostname/sample-item-1
- and request to above url (i.e. http://hostname/sample-item-1) returns item not found error.
As a solution to the above issue, in earlier versions of Sitecore, what we did was to restrict hyphens (-) character from item names, by adding hyphen into "InvalidItemNameChars" setting.
<setting name="InvalidItemNameChars" value="\/:?"<>|[]-" />This option restricted Content Editors by creating item names with hyphen character.
BUT,
With this new functionality introduced with Sitecore 8.1 Update-2, Sitecore will process above kind of senario URL's without any issue and successfully find the correct item to render.
Below is the video in Sitecore for Dummies YouTube channel, which discuss about this setting.
Happy Sitecore!
No comments:
Post a Comment