You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After I import a PnP Site Template with "Invoke-PnPSiteTemplate" command, which has page templates in Site Pages library with layout type "NoImage", these pages always has value "fullWidthImage".
Expected behavior
If my site template has pages with "NoImage" layout and I use Invoke-PnPSiteTemplate, it should be use value that I have defined in site template, not default ones.
Despite of that, if I use command Set-PnPPage with parameter "HeaderLayoutType", it should change page header layout type, as documentation says, to allowed values: ColorBlock, CutInShape, FullWidthImage, NoImage.
Actual behavior
I use "Invoke-PnPSiteTemplate" command with a site template which has page templates in Site Pages library with layout type "NoImage", but these pages always has value "fullWidthImage".
I try to change page layout to set value "NoImage" with command
Did you figure anything out? I also am experiencing the same issue.
Hi @rachaelsingleton , I was investigating and I realised that bug only affects with "Invoke-PnPSiteTemplate" action. So, if you create page template with this command:
Page template will create succesfully with provided page header, even if you want to change it later with "Set-PnPPage" command. This avoids to use "Invoke-PnPSiteTemplate" -which produces the bug, I think- and keeps code simple.
In my particular case, I need to use "Invoke-PnPSiteTemplate" because my site template contains a lot of configuration about page templates, so I have to use an ugly code workaround:
First, I get my template pages from siteTemplate XML and create them using PnP Command "Add-PnPPage":
Then, I use "Invoke-PnPSiteTemplate" to overwrite recently created template pages with desired configuration. Note: Page layout will be overwrited with "FullWidthImage" value again, but I will fix it in next step.
Invoke-PnPSiteTemplate -Path "siteTemplate.xml"
Finally, I fix all my template pages again with a loop:
foreach($page in $allPages)
{
if ($page.PageName.StartsWith("Templates/"))
{
$clientSidePage= Get-PnPClientSidePage -Identity $page.PageName;
$clientSidePage.PageHeader.LayoutType = $page.PageHeader.LayoutType;
$clientSidePage.save();
$clientSidePage.Publish();
#Alternative: you can use this command "Set-PnPPage -Identity $page.PageName -HeaderLayoutType $page.PageHeader.LayoutType" instead of above lines
}
}
I know is an ugly code, but it was the only way I found to skip somehow this bug. I hope it will be usefull for you while someone fix PnP Framework engine for this case.
Reporting an Issue or Missing Feature
After I import a PnP Site Template with "Invoke-PnPSiteTemplate" command, which has page templates in Site Pages library with layout type "NoImage", these pages always has value "fullWidthImage".
Expected behavior
If my site template has pages with "NoImage" layout and I use Invoke-PnPSiteTemplate, it should be use value that I have defined in site template, not default ones.
Despite of that, if I use command Set-PnPPage with parameter "HeaderLayoutType", it should change page header layout type, as documentation says, to allowed values: ColorBlock, CutInShape, FullWidthImage, NoImage.
Actual behavior
I use "Invoke-PnPSiteTemplate" command with a site template which has page templates in Site Pages library with layout type "NoImage", but these pages always has value "fullWidthImage".
I try to change page layout to set value "NoImage" with command
Set-PnPPage -Identity "PageName" -HeaderLayoutType "NoImage"
but nothing changes. Page always have layout type "FullWidthImage".
I have tried to get page with Get-PnPPage and update layout value specifically:
$pageToEdit = Get-PnPPage -Identity "PageName";
$pageToEdit.PageHeader.LayoutType = "NoImage";
$pageToEdit.Save();
$pageToEdit.Publish();
but nothing changes either.
Steps to reproduce behavior
I have a PnP Site Template "siteTemplate.xml" with one Page Template that has layout type "NoImage":
<?xml version="1.0" encoding="utf-8"?> <pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2022/09/ProvisioningSchema"> <pnp:Preferences Generator="PnP.Framework, Version=1.17.30.0, Culture=neutral, PublicKeyToken=0d501f89f11b748c" /> <pnp:Templates ID="CONTAINER-TEMPLATE-515B3B3499114765B66FF42C860F5626"> <pnp:ProvisioningTemplate ID="TEMPLATE-515B3B3499114765B66FF42C860F5626" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite"> <pnp:ClientSidePages> <pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="true" Overwrite="true" Title="TestTemplate" ThumbnailUrl="" PageName="Templates/TestTemplate.aspx"> <pnp:Header Type="Default" LayoutType="NoImage" ShowTopicHeader="false" ShowPublishDate="false" ShowBackgroundGradient="false" TopicHeader="" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" /> </pnp:ClientSidePage> </pnp:ClientSidePages> </pnp:ProvisioningTemplate> </pnp:Templates> </pnp:Provisioning>
Then I use this command to apply site template:
Invoke-PnPSiteTemplate -Path "siteTemplate.xml";
When I get page template layout, I retrieve this value:
(Get-PnPPage -Identity "Templates/TestTemplate.aspx").PageHeader.LayoutType;
"FullWidthImage";
I try to change it with Powershell:
Set-PnPPage -Identity "Templates/TestTemplate.aspx" -HeaderLayoutType "NoImage";
Nothing changes:
(Get-PnPPage -Identity "Templates/TestTemplate.aspx").PageHeader.LayoutType;
"FullWidthImage";
Also I try to change it with commands:
$pageToEdit = Get-PnPPage -Identity "Templates/TestTemplate.aspx";
$pageToEdit.PageHeader.LayoutType = "NoImage";
$pageToEdit.Save();
$pageToEdit.Publish();
Nothing changes:
(Get-PnPPage -Identity "Templates/TestTemplate.aspx").PageHeader.LayoutType;
"FullWidthImage";
😢
What is the version of the Cmdlet module you are running?
PnP.PowerShell 2.12.0
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: