Show Boosted News with PnP Modern Search Web Parts

Feature for boosting news was originally announced on Microsoft Ignite 2020. Now the first version of News Boost is available on SharePoint Online. Currently, it allows news items to be boosted based on the expiry date and boosted news posts are visible to users on automatic news digests. On Ignite it was also announced that News Boost will be based on until users have seen the news post and a number of views for a post, and web parts would show boosted news on SharePoint pages. Let’s hope these features are landing soon.

News Boost features announced on Ignite 2020

In the meanwhile, it is already possible to show boosted news from current site, from the hub and even across the tenant using PnP Modern Search Web Parts and configuring search schema.

Boosting News (features in August 2021)

News can be only boosted from SharePoint Home Site or sites set as organization’s news sites. News post can be boosted after it is published by clicking Boost.

Boost the news post

Currently, only an expiration date can be set. If there is multiple boosted news post on that specific site, the current post can be sorted.

Boost pane

Other boosted posts can be easily accessed from Boost pane links. Note that posts only from that specific site are visible on Boost Pane and boost order values are recalculated based on those posts. Boosted news from other sites are not affected.

Limitations:

  • News can be boosted from organizational news site and from SharePoint Home Site
  • Currently (August 2021), boosted news are shown in auto news digests only.
  • A maximum 10 news posts can be boosted at one time

Search Properties and Configuration

Boosted news posts can be retrieved using search. First, let’s find out all the boost-related Search Managed Properties.

News Boost Managed Properties on Search

As seen in the image above, seems that managed properties for Ignite 2020 announced features are already defined in the Search schema. Currently, only the expiration date and order can be set on boosted news, so let’s focus on those. BoostUntilSeen and BoostUntilUserViewedCount properties are not yet returning correct values.

Investigating with PnP Modern Search Web Parts

PnP Modern Search Web Parts are really useful to debug and investigate search properties as well.

First, add the PnP Search Results Web Part to a page.

Add Search Results Web Part

Open the web part configuration pane and add next code sample to Search query keywords.

1PromotedState=2 AND BoostExpiryDate>=Today

If there is already boosted news posts, they are displayed on the web part.

Search web part results

On the second page of the web part configuration, check BoostExpiryDate and BoostOrder on Selected Properties setting.

Selected Properties setting

On the third configuration page, select Debug layout.

Results layout

BoostOrder and BoostExpiryDate are now visible on debug layout.

Debug view

I like to use the Details list view for debugging as well to see just the information I need. With the Manage columns setting I can pick just the properties I’m interested in. Much easier, if you need to see properties from a list of results.

Details list view and manage columns

Add BoostOrder and BoostExpiryDate columns.

Configuring columns

List of boosted news posts with order and expiry date information.

Debugging Boost Order and Expiry Date

Sorting boosted news

Order of boosted news is based on BoostOrder value in descending order. BoostOrder managed property is not set as sortable, and it is not possible to modify the sortable setting of system-defined managed properties.

BoostOrder property

As a workaround, it is possible to use predefined RefinableDouble managed properties, which are set as sortable. In this example, I’m using RefinableDouble00 and mapping it to ows__BoostOrder crawled property.

Add a mapping
Map ows__BoostOrder

Save the managed property configuration. It takes a while when search schema and index are up-to-date.

Sorting can be enabled from the Edit sort order setting on the Search Result web part and adding, in this example case, RefinableDouble00 as sortable property with the direction set as descending.

Note that news boost sorting is made per site. If boosted news are retrieved from multiple sites, order of post between different sites cannot be configured.

Edit sort order setting
RefinableDouble00 as sortable property
Boosted news in correct order

PnP Modern Search Web Parts have already nice layouts to display news, and it’s also possible to create custom layouts.

Boosted news in PnP Modern Search Results

Afterword

News Boost is a good addition to the communications capabilities of SharePoint Online. In the future, important announcements, news, and articles are getting better visibility. Personally I’m really looking forward to the feature for boosting news until seen by a user, that is really something that has been asked for ages on different SharePoint versions. Also, News Boost is based on search, which makes it more customizable using SharePoint Framework or ready-made search web parts.

Big thank goes to the awesome PnP Community members, who have been creating and maintaining PnP Search Web Parts.

Useful links:

To setup a SharePoint Home Site, follow this article: https://docs.microsoft.com/en-us/sharepoint/home-site

To setup an organization news site, follow this article: https://docs.microsoft.com/en-us/sharepoint/organization-news-site

This blog is part of SharePoint Week. For more great content, click here

About the Author:

Reference:

Paukkonen, M. (2021). Show Boosted News with PnP Modern Search Web Parts. Available at: https://mattipaukkonen.com/2021/08/10/show-boosted-news-with-pnp-modern-search-web-parts/ [Accessed: 14th September 2021].

Share this on...

Rate this Post:

Share: