SOLVED

How to make a multi-site metadata filter for the news webpart work?

Copper Contributor

I have a custom metadata property for a news expiration date. On a news page, people can edit the expiration date and set the page to expire by whichever date they choose. This works on each site. However, when I am unable to get this property to work when a news webpart is getting news from multiple sites. This is what I mean: selectSites.PNG

 

This is what the property looks like when it's filtering by only one site (it works here): ExpirationDate.PNG

I want to take the same approach with the webpart that pulls from multiple sites: Notworking.PNG

 

I try and type [AFTER] into the dropdown, but it won't save that option. Is there another way I can get this expiration date property to work?

4 Replies

Hello @GreenBlueToZu 

 

i'm not sure, if that possible with the OOTB news web part, but you can try an kql conform filter parameter also like < or >:

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-synt...

 

When it's not work, i see to other way's:

- Highlighted content web part: You can use KQLin a custom filter, but not the same visualization

- PnP Modern Search Web Parts: You can use KQL and can fully customize the visualization https://microsoft-search.github.io/pnp-modern-search/ 

 

Regards, Dave

best response confirmed by GreenBlueToZu (Copper Contributor)
Solution

@David Mehr 

Hi David,

I made my own custom solution. I made a custom metadata property called isExpired. This property outputs "YES" in text form if it detects a page has expired. If a page hasn't expired, it outputs "NO". I made it output text rather than a yes/no, because I heard the news webpart doesn't support the yes/no content type. The isExpired column/property looks at my expiration date column that holds the expiration date. The isExpired column is a calculated column. This is the formula I used for the calculated column: 

=IF([Expiration Date]<TODAY(),"YES","NO")

 

On the news web part, I'm now able to filter using my isExpired property. I filtered by managed property, and then isExpired contains NO.

 

My filter is working now. I appreciate that you tried to help though. Have a good day~

@GreenBlueToZu Thank you so much for this info, this is exactly the solution I was looking for. However, I'm getting a bit hung up. I successfully created "isExpired" as a calculated managed property, and it is showing up as a column, and it is properly calculating (no or yes) on each site page,  but it's not available when I start typing in "isEx..." in the final step of your instructions:

On the news web part, I'm now able to filter using my isExpired property. I filtered by managed property, and then isExpired contains NO.

 

I'm not sure how to make "isExpired" an option in this section. I can manually type "isExpired" in the "Enter a word to find properties" field, but it's never "found" and then weirdly all the expired news actually pulls into my news webpart instead.  Any ideas? Thanks!

Sorry for the late response. I didn't see this comment until now. I think you need to reindex the pages where you are using the isExpired metadata. This will refresh the columns and allow for Microsoft to crawl through your properties (this refresh takes a couple of days to make the isExpired column/metadata show up).

To do this, go to settings, then site contents, then site pages. Click library settings. Then click advanced settings. Click the reindex document library button. You will need to do this for each library you are using the isExpired metadata on.

If you added the isExpired metadata using the content types editor, then you will need to go into each site you are using that content type on, and click the refresh button on that content type.
1 best response

Accepted Solutions
best response confirmed by GreenBlueToZu (Copper Contributor)
Solution

@David Mehr 

Hi David,

I made my own custom solution. I made a custom metadata property called isExpired. This property outputs "YES" in text form if it detects a page has expired. If a page hasn't expired, it outputs "NO". I made it output text rather than a yes/no, because I heard the news webpart doesn't support the yes/no content type. The isExpired column/property looks at my expiration date column that holds the expiration date. The isExpired column is a calculated column. This is the formula I used for the calculated column: 

=IF([Expiration Date]<TODAY(),"YES","NO")

 

On the news web part, I'm now able to filter using my isExpired property. I filtered by managed property, and then isExpired contains NO.

 

My filter is working now. I appreciate that you tried to help though. Have a good day~

View solution in original post