Here's a gist that contains Reddit's popularity algorithm that you could use. It's pretty simple and just uses upvote, but you could add in comments and impressions to the calculation too. https://gist.github.com/nanosplit/db42e507c5d1d984b664868db10a3669
This is another approach that you should check out. https://www.akitaonrails.com/2016/10/31/ruby-on-rails-implementation-of-a-proper-ranking-popularity-system
Join 31,152+ developers who get early access to new screencasts, articles, guides, updates, and more.