Forum Discussion
How to make a multi-site metadata filter for the news webpart work?
- Sep 27, 2022
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
- GreenBlueToZuSep 27, 2022Copper 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~
- kekraleyOct 25, 2022Copper 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!
- GreenBlueToZuApr 21, 2023Copper ContributorSorry 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.