Wanted: Hot sorting criteria for front-page

Following up on this thread from last year.

We would like to use a sorting criteria as Hacker News to make sure we’re always serving the most popular content to our users. We’re imagining using a similar algorithm to the one used on Hacker News.

Basically it should sort all topics on our forum on the front-page after this criteria - so you can keep scrolling forever. (Unlike top topics in Discourse today, which is limited to a pre-set number of topics within a time range)

We would like to use this simple algorithm:

Variables
L: Total number of likes on posts in topic
T: Hours since topic was created
G: Gravity (rate at which topics loose their position on the front-page)

G = 1.5

Score = L / (T + 2)^G

The gravity rate should be able to be changed from the settings page for admins of the forum.

Why not just use the default Top view
While we would like to use it, a number of things are different

  • The top view only shows popular topics created within the specific timeframe, e.g. a week. We want to show what was popular the last week - no matter the creation date of the topic.
  • The settings for the “Top view” is bizarre and requires the admin to specific a precise amount of posts to be shown for the desired timeframe, e.g. weekly. If there are not enough posts from this period, it switches the timeframe to monthly top posts.

More background here, here and here

Requirements

  • New filter in top menu on discourse installation
  • Has to be able to set as default filter of front-page, e.g. the landing page of a discourse installation
  • Has to filter based on above algorithm with the variable G - gravity - being able to be tweaked from the admin page
  • The filtering should filter all topics on the Discourse installation, e.g. so the user can continue to scroll forever and should not be limited to a fixed number of posts

We’re looking for developers from the community to help build this plugin, please get in touch if you’re interested.
Potentially a paid project.

Use the Top filter as the base for this, and change the setting for the sorting in Admin settings to make Top always load on dafault. Then tweak the following file and register it in your plugin:

https://github.com/discourse/discourse/blob/master/app/models/top_topic.rb#L143-L192

I think that would be the way unless I am missing something. I personally use only Top and Latest, and for now they are working fine for my use case. Hope this helps.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.