Forum Discussion
Priscilla1207
Nov 04, 2022Copper Contributor
News post does not appear on home page
I'm quite new to this, so please correct my knowledge if needed! I add new story using news post. But when I publish it. It doesn't show up on the home page nor the 'News Archive' page. I have t...
YaYa
Feb 26, 2025Copper Contributor
For my part, the user had created a simple site page instead of a news post. I noticed this by checking the "Promoted State" column, which was set to 0 instead of 2, and the "First Published Date" column, which was empty. I then had to run my script, which converted the page into a news post and made it appear on the homepage.
Connect-PnPOnline -Url "xxxx" `
-ClientId "xxxxx" `
-Tenant "xxxxx" `
-CertificatePath "xxxxx"
$page = Get-PnPListItem -List "SitePages" -Query "<View><Query><Where><Eq><FieldRef Name='FileLeafRef' /><Value Type='Text'>xxxxx.aspx</Value></Eq></Where></Query></View>"
Set-PnPListItem -List "SitePages" -Identity $page.Id -Values @{"PromotedState"=2}
$utcDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
Set-PnPListItem -List "SitePages" -Identity $page.Id -Values @{"FirstPublishedDate" = $utcDate}