SiteDefinition 和 ContentBySearchWebPart
-
10-12-2019 - |
题
我有 ContentBySearchWebPart 的自定义模板。我尝试通过在 onet.xml 中实现的模块添加这些模板和带有 ContentBySearchWebPart 的页面。我的问题是当配置 Web 部件时, ItemTemplateId
和 RenderTemplateId
属性设置为默认值。我的设置被忽略。如何解决这个问题?
解决方案
看来图块 (~) 需要进行 xml 转义才能正确解析。所以:
<property name="ItemTemplateId" type="string">~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Item_TwoLines.js</property>'''
应该变成:
<property name="ItemTemplateId" type="string">~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Item_TwoLines.js</property>
正如我发现的 http://www.sharepointnutsandbolts.com/2013/04/provisioning-content-search-web-part.html