SOLVED

Escape tokens in pnp provisioning template

Copper Contributor

When applying a provisioning template including a page template, a token such as {site}, {siteid}, or {sitename} will get replaced with its associated value. These tokens are often useful to preserve as-is within the properties of a custom web part (see attachment).

I've tried replacing the brackets in the token with html entities, but this doesn't preserve the tokens - this doesn't escape them.

I.e. for a custom web part with at least one string field, url, I've tried using {Site} instead of {Site}, but during provisioning the token is still replaced with the relative site uri (many parameters omitted for brevity):


<pnp:CanvasControl WebPartType="Custom" JsonControlData="{&quot;properties&quot;: {&quot;url&quot;:&quot;&#123;Site&#125;/SitePages/Search.aspx&quot;}}"/>

Is there some way to escape a token to prevent it from being interpreted when applying the page template?

2 Replies
best response confirmed by Dean Verleger (Copper Contributor)
Solution

@Dean Verleger 

You can also try "{site.URL}" instead of {site}. This will not be replaced by the relative URL, and has the same functionality as {site}. 

Thanks for the tip! I'll try that out next time.
1 best response

Accepted Solutions
best response confirmed by Dean Verleger (Copper Contributor)
Solution

@Dean Verleger 

You can also try "{site.URL}" instead of {site}. This will not be replaced by the relative URL, and has the same functionality as {site}. 

View solution in original post