Forum Discussion

Dean Verleger's avatar
Dean Verleger
Copper Contributor
Jan 31, 2020

Escape tokens in pnp provisioning template

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?

  • 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}. 

  • MLeysen's avatar
    MLeysen
    Copper Contributor

    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}. 

Resources