Access "News from Sites" programmatically

Highlighted
Occasional Contributor

I would like to reuse the "News from Sites" news aggregation from the SharePoint Homepage in my own site collection. Is there a way to programmatically get all news from SharePoint sites that the current user is following?

3 Replies
Highlighted
I found that there is a crawled property ("PromotedState") which you can then map in search schema to a Refinable property. Then you can just use this in Content by Search web parts. The 'News from Sites' content type has a value of '2' in the PromotedState property, so you can filter your search results to that and return all news pages. Hope that helps.
Highlighted
Actually, if you google 'PromotedState' you come up with this page from Elio Struyf who does a far more detailed explanation of this. https://www.eliostruyf.com/what-makes-a-page-to-be-a-news-page-on-sharepoint-online/
Highlighted

Excellent, thank you. 

Is there any way to use a content by search in modern site pages?