Where are my Coveo for Sitecore placeholders?

I recently had the opportunity to work with the latest Coveo for Sitecore release (Oct 2017 4.1) that includes the new Coveo Hive Framework. While working with this release I discovered an issue where my placeholders did not appear in Sitecore Experience Editor. Here is what this looks like in Experience Editor. No placeholders appear and therefore new components cannot be added in Experience Editor.

Problem

To investigate the problem, I created a new Sitecore 8.2 instance and installed the Coveo for Sitecore Oct 2017 4.1 release and was not able to reproduce it. After digging further into the issue I found the problem was related to a conflict between the (incredibly useful) Sitecore Dynamic Placeholders module and Coveo's Dynamic Placeholder implementation. If you are not familiar with the Sitecore Dynamic Placeholders module you can find it on NuGet here or on GitHub here.

The problem was that the Dynamic Placeholder module inadvertently identified Coveo Dynamic placeholders using a regular expression and circumvented the expected logic.

Solution

To resolve the issue, I used the configuration setting, DynamicPlaceholdersRegex, provided by the Dynamic Placeholder module. The new regular expression below ignores the Coveo dynamic placeholders that include the text "_dynamic__" before matching the dynamic placeholder by the expected GUID pattern.
<setting name="DynamicPlaceholdersRegex" value="^(?!.*_dynamic__)(.+?)_[\d\w]{8}\-(?:[\d\w]{4}\-){3}[\d\w]{12}(?:_.+)?" />
Here is the same view of Experience Editor with the expected placeholders.

 
I hope this helps someone else in need. Take care and enjoy your Sitecore Sundae!


P.S. if you have not had a chance to use the Coveo Hive Framework, I would highly recommend you take it for a test drive. The new framework introduces a much more modular component design and a cleaner Sitecore approach of separating renderings and data sources. Check out this great blog about Coveo Hive here by Coveo's own Simon Langevin.

Comments

Popular posts from this blog

Why a better search experience builds your brand

Sitecore JSS Meets TeamCity

Strategy to Separate Code from Content