You need to use DemoteNewsArticle
method the PnPClientSidePage
to un-publish
it as news article.
Use the PnP commands as mentioned below:
Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/test"
# url of the page without aspx or title of the page
# if your page url is Test.aspx, pass the Identity parameter as Test
$clientSidePage = Get-PnPClientSidePage -Identity "Test"
$clientSidePage.DemoteNewsArticle()
If you want to Promote it again, the use:
$clientPage.PromoteAsNewsArticle()
Reference - ClientSidePage.DemoteNewsArticle Method
Update - No way its possible OOTB. However, the whether its published as news or not is determined by PromotedState
column value. You can choose via PowerShell to show its value in the edit form of the Site Page. Now, when the value is set to 0, it will be unpublished , when its set to 2 , it will show up in the news.
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/test"
$context = Get-PnPContext
$list = Get-PnPList -Identity "Site Pages"
$context.Load($list.Fields)
$context.ExecuteQuery()
$field = $list.Fields.GetByInternalNameOrTitle("PromotedState")
$field.SetShowInEditForm($true)
$field.Update()
$context.ExecuteQuery()
This column is by default hidden, so we are just showing it on the edit properties page. So, if by mistake some user has posted it as news, they can simply change the value to 0 in the edit form.