Forum Discussion
PnP Provisioning Engine template support for publishing pages ?
Yes, you need a local file for what you specified in the src attribute. So in my code sample below mypublishingpage.aspx should be a local file located at the location you specified in your TemplateProvider (connectionstring / container). If you use PowerShell to apply your template the file should be located in location within or relative to the folder from which your PowerShell is executed
The contents of the file, in case where a PublishingPageLayout should indeed be the TemplateRedirectionPage markup you mentioned.
<pnp:File src="mypublishingpage.aspx" Folder="{site}/Pages" Overwrite="true"> <pnp:Properties> <pnp:Property Key="ContentTypeId" Value="{contenttypeid:MyPageContentType}" /> <pnp:Property Key="Title" Value="My Publishing Page" /> <pnp:Property Key="PublishingPageLayout" Value="{sitecollection}/_catalogs/masterpage/MyPageLayout.aspx, My Page Layout" /> </pnp:Properties> <pnp:WebParts> <pnp:WebPart Order="0" Title="Your WebPart Title" Zone="Center"> <pnp:Contents> <!-- your exported WebPart XML --> </pnp:Contents> </pnp:WebPart> </pnp:WebParts> </pnp:File>
Hmmm...now how to handle upgrade scenarios where we want to redeploy the page...getting the old "duplicate web parts deployed issue"...
- paulpaschaFeb 22, 2017Bronze Contributor
We've implemented a custom Provider / Extensibility Handler to handle some upgrade scenarios (e.g. overwriting a previously deployed WebPart, removing WebParts not defined in your template). I can share the raw code with you if you like...
- BrianPMcCullough00Feb 22, 2017Copper Contributor
Yeah, I was just reading up on the pnp:Providers and pnp:Extensions stuff as I was thinking that'd be the way to handle it. Love to see your stuff as a starting point. If not comfortable sharing here, let me know and we can look for other ways to communicate/collaborate.
Thanks!
- paulpaschaFeb 22, 2017Bronze Contributor
Here you have it... Hope there's something usefull in it!