I am using CMS 11 with .NET Framework 4.6 and I am trying to implement a filter for news articles for news and events list to filter them based on the month or year of publish.
Has anyone attempted it or does anyone has any reference to how it can be done? Please let me know,
I am also trying to add pagination to the list. If anyone has any references, please let me know.
Are you in the DXP? If so this should all be done using Search & Navigation https://world.optimizely.com/documentation/developer-guides/search-navigation/NET-Client-API/
If not you should use a different search system such as direct Elastic, Lucene or some sort for these types of filters.
Well, I second using Search & Navigation (if it's available) although there are many, many ways to achieve this.
You can easily use sorting (https://world.optimizely.com/documentation/developer-guides/search-navigation/NET-Client-API/searching/Sorting/) with skip & take (https://world.optimizely.com/documentation/developer-guides/search-navigation/NET-Client-API/searching/Pagination-Skip-and-Take/) to achieve pagination.
I'm sure this functionality has been built a lot of times, but how you design and build it would be based on your specific requirements and stack.
Search & Navigation is one of the best option to achieve that.
Here are the implementations to get inspired:
Filter by Year: https://www.michiganbusiness.org/press-releases/
Filter by Year & Category : https://www.michiganbusiness.org/news/2022/