Protiviti / SharePoint Blog

SharePoint Blog

September 14
Tilde Wildcard in SharePoint Site Templates

​When saving a site as a site template or exporting a webpart from a page, sometimes you will notice settings such as Display Template or XSLT references revert to their default values and not retain settings.  The reason for this is SharePoint’s fault. SharePoint exports the XML for these things using a ~ wildcard in the format

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


The key part is in bold. The tilde on ~sitecollection needs to be escaped with &#126;  Doing this allows custom Display Templates and other referenced resources work correctly.

To correct this in Site Templates, I use IZArc to repackage the .wsp file.  The steps for this are as follows:

1. Download a copy of your Site Template from the Solutions gallery.
2. Change the extension on the file from .wsp to .cab.
3. Extract the .cab file
4. Edit the appropriate XML files within the extracted .cab
5. Open IZArc and click “New”.
6. Type a file name for your new .wsp.
7. On the “Add Files” dialog select the entire contents of the extracted .cab file. Do not select the folder containing the extraction.  Select everything inside that folder.
8. On the “Options” tab change “Archiving Type” to “CAB” then click “OK”
9. Rename your new .cab to .wsp

Quick Launch


© Protiviti 2019. All rights reserved.   |   Privacy Policy