Sharepoint news from different sites with filter functionality

Copper Contributor

Good morning and thanks for reading my question,

 

I'm trying to create a SP page containing a repository of news articles posted on various SP sites with a filter functionality so people can easily find articles meeting certain metadata requirements such as date of publication, place of publication on SP, subject, label category, etc. I was notified that this is not possible with PnP 'modern search filter' webpart, because most of the articles are not stored in the document library of the site I am publishing this filter capability on. I'm hoping to find other ideas for how I can reach my goal. Thanks in advance!

2 Replies

Hi @unimportant 

You want to gather news articles from various SharePoint sites and enable filtering based on metadata like publication date, location, subject, and labels. While the PnP 'modern search filter' web part isn't suitable, you have alternative options:

  1. Content Search Web Part (CSWP): Display content from different sites with customized queries for filtering.

  2. Custom Search Web Part: Develop a tailored solution using SharePoint Framework (SPFx) for precise control.

  3. Hub Sites: Use hub sites if news sites are linked for centralized aggregation.

  4. Custom Solutions: Consider coding a unique solution using SharePoint's APIs.

  5. Third-Party Tools: Explore marketplace apps for advanced aggregation and filtering.

Involve your SharePoint experts to select the best fit. Good luck! If you need more guidance, feel free to ask.

Hi @unimportant ,

on the contrary, I would use the "PnP Modern Search" webparts in this case.

https://microsoft-search.github.io/pnp-modern-search/

You can use the SharePoint Search to find all news articles from different sites.
Just search for

PromotedState=2

If you want to find all news from all sites (News and only news have a property "Promoted State" with a value of 2)

SvenSieverding_1-1691913384809.png

 

 


or if you want to search news of the sites "site1" and "site2" 

PromotedState=2 (path:https://<tenant>.sharepoint.com/sites/<site1>/ OR path:https://<tenant>.sharepoint.com/sites/<site1>/)

or if you want to find news from all sites in a specific hubsite.

PromotedState=2 DepartmentID:<Guid of your Hubsite>

 

 


Then configure and connect a "Search Filters" webpart with your "Search Results" webpart and define the filters/refiners you want to enable your users to search with.

SvenSieverding_2-1691913518623.png

 

You can use all properties that are defined as "refinable" in the search schema (see here: https://learn.microsoft.com/en-us/sharepoint/technical-reference/crawled-and-managed-properties-over... )


If you have custom news properties on your sites then it is a little bit more complicated. In that case you might have to map your custom properties on every site to one of the default "RefinableStringXXX" managed properties (using https://<tenant>.sharepoint.com/sites/<yoursite>/_layouts/15/listmanagedproperties.aspx?level=siteco... ). Then re-index the "SitePages" library.
After that you can search for "RefinableStringXXX:YourValue" to filter search results by your value.

 


If you don't want to use the PnP Search Webparts then you also can do this using the "Highlighted Contents" Webpart.

Switch it to "Custom Query" and enter the query in the  "Query text (KQL)" field.

SvenSieverding_0-1691913314910.png


But you are not able the add dynamic refiners to the search results of that webpart. But you can use that to have some pages with pre-configured filters.


Best Regards,
Sven