Inserting an Example Search Page Results in No Renderings
Inserting an Example Search Page Results in No Renderings
Symptoms
When inserting an item from the Example Search Page branch, the resulting item has no renderings.
Cause
A conflict occurs with a Coveo Hive processor when modifying the item Display Name
attribute in the item:saving
event.
Instead of using the branch field values, the processor uses the item Standard Values. This removes all the renderings from the newly created item layouts.
The Coveo Hive processor can’t update the renderings defined on the newly created items since they’re no longer returned by Sitecore.
Resolution
There are two ways to solve this issue.
Change the Event Type
Sitecore recommends changing the event type from item:saving
to item:saved
, as the problem only occurs when using item:saving
.
Changing the type therefore fixes the issue.
Remove the Code That Modifies the Display Name
Find the handler that changes the item Display Name
in the item:saving
event and temporarily disable it to create the Example Search Page.
Here is an example of code that modifies this attribute:
item.Editing.BeginEdit();
item.Appearance.DisplayName = item.Name.Replace(" ", "-");
item.Editing.EndEdit();
If you’re using Launch Sitecore, the fix is to comment out the following line in the www.LaunchSitecore.config
file, in the <event name="item:saving>
node:
<handler type="LaunchSitecore.Configuration.AuthoringExperience.ItemNaming.ItemNameHyphenHandler, LaunchSitecore" method="OnItemSaving" x:after="handler[@type='Sitecore.Tasks.ItemEventHandler']" />