Trending
Up to: Features
Trending posts and hashtags to help with content discoverability!
Usage
Go to the Explore tab!
From there you are given four menus,
- Posts
- Hashtags
- People
- News (popular links)
Implementation
Trends are defined in a family of models in mastodon/app/models/trends
: https://github.com/NeuromatchAcademy/mastodon/tree/main/app/models/trends
Eg. for Statuses
the trending scores are calculated here:
def calculate_scores(statuses, at_time)
items = statuses.map do |status|
expected = 1.0
observed = (status.reblogs_count + status.favourites_count).to_f
score = if expected > observed || observed < options[:threshold]
0
else
((observed - expected)**2) / expected
end
decaying_score = if score.zero? || !eligible?(status)
0
else
score * (0.5**((at_time.to_f - status.created_at.to_f) / options[:score_halflife].to_f))
end
[decaying_score, status]
end
AKA the score is a sum of reblogs and favorites with some exponential time decay.
Config
In the Administration > Server Settings > Discovery menu...
Available options:
- Enable Trends
- Use trends as the landing page
- Allow trends without prior review
- Allow posts with content warnings to trend