Forum Discussion
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="{"properties": {"url":"{Site}/SitePages/Search.aspx"}}"/>
Is there some way to escape a token to prevent it from being interpreted when applying the page template?
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}.
- MLeysenCopper Contributor
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}.
- Dean VerlegerCopper ContributorThanks for the tip! I'll try that out next time.