Question

I have custom templates for a ContentBySearchWebPart. I tries to add these templates and a page with ContentBySearchWebPart by module which is implemented into onet.xml. My issue is when the web part is provisioned, the ItemTemplateId and RenderTemplateId properties are set to default values. My settings are ignored. How to solve this issue?

Was it helpful?

Solution

It appears the tile (~) needs to be xml escaped to be parsed correctly. So:

<property name="ItemTemplateId" type="string">~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Item_TwoLines.js</property>'''

Should become:

<property name="ItemTemplateId" type="string">&#126;sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Item_TwoLines.js</property>

As I found on http://www.sharepointnutsandbolts.com/2013/04/provisioning-content-search-web-part.html

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top