Forum Discussion
GreenBlueToZu
Sep 21, 2022Copper Contributor
How to make a multi-site metadata filter for the news webpart work?
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?
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~
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 >:
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
- GreenBlueToZuCopper Contributor
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~
- kekraleyCopper Contributor
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!