News Posts created via PnP PowerShell using a Page Template don't reflect in News Webpart Properly

Contributor

I've created some News Posts via PnP PowerShell based on a Page Template which has a single image and some sample text.

I then update the text via PowerShell and publish the changes. Everything looks great on the News Post, but when I go into the News Web Part it doesn't show the image (just a placeholder image) and shows the original sample text from the Template and not the text I updated.

If I then go into the News Post, Edit and click on Update news (with or without making any changes to the page), the News Webpart then picks up the image and text correctly.

 

$newsTemplate = Get-PnPPage "Templates/News-Template.aspx"
$pageName = $newsTemplate.Save("MyNewsPost.aspx")
$clientPage = Get-PnPPage -Identity $pageName
Set-PnPPageTextPart -Page $pageName -InstanceId $clientPage.Controls[1].InstanceId -Text "Text I want to display in the News Post"
Set-PnPPage -Identity $clientPage.Name -Title "Title Of News Post" -PromoteAs NewsArticle -CommentsEnabled:$false -Publish

 

Any ideas on whether this is a known bug? Or is there something that I'm not doing?

 

What it looks like in the News Webpart after initial creation via PowerShell. Note the placeholder image and text from the Page Template.

gjen020_0-1664438470783.png

 

What it looks like in the News Webpart when I go into the News Post, click on Edit, then click on Update news. News Webpart now picks up the image and my text correctly.

gjen020_1-1664438573395.png

 

 

0 Replies