How can I implement a trending posts or articles feature?
I'd like to be able to autoIncrement a post's views every time the record is accessed. However this wouldn't be enough on its own.
For trending posts we need to compare access over a short time period, 2-3 days for example, otherwise the displayed posts would create a positive feedback cycle.
I've considered doing this with an API route in NextJS (to read and prune data within a record based on custom date + views fields), however I was wondering whether I could use any of the built-in Payload hooks to achieve this?
Any thoughts or advice would be greatly appreciated!