Skip to content

[BUG] Page templates always have layout type FullWidthImage when I use Invoke-PnPSiteTemplate #1112

Open
@mfdezvil

Description

@mfdezvil

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?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions