# How do you customize hot topic score algorithm with a plugin?

**URL:** <https://meta.discourse.org/t/how-do-you-customize-hot-topic-score-algorithm-with-a-plugin/396003>\
**Category:** Development\
**Created:** [February 13, 2026, 9:13am UTC](https://meta.discourse.org/t/how-do-you-customize-hot-topic-score-algorithm-with-a-plugin/396003 "2026-02-13T09:13:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![fangjue](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@fangjue](https://meta.discourse.org/u/fangjue)\
**Post date:** [February 13, 2026, 9:13am UTC](https://meta.discourse.org/t/how-do-you-customize-hot-topic-score-algorithm-with-a-plugin/396003/1 "2026-02-13T09:13:44Z")

</div>

The built-in [Hot sorting](https://meta.discourse.org/t/discover-popular-conversations-in-your-community-with-hot-topic-sorting/296747) [algorithm](https://github.com/discourse/discourse/blob/main/app/models/topic_hot_score.rb#L42) is very simple and might not be suitable for different use cases. From my basic understanding of Discourse codebase, currently there is not user-facing site settings or appropriate plugin injection point for customizing hot sorting algorithm. There is one `topic_hot_scores_updated` event but it is called after scores are updated, which serves the purpose of _notification_ without the ability to _override_ built-in hot scores. There are two site settings `hot_topics_gravity` and `hot_topics_recent_days` but they have `hidden: true` set and are not visible in admin UI.

We are considering writing a plugin to replace the built-in hot score algorithm. What approach would be better in terms of compatibility and ease of upgrading Discourse in the future? Some of my ideas are listed below:

- Monkey-patch `TopicHotScore` and update db according to our custom algorithm.
- Create a separate table to store topic hot scores and run a separate background job to update them. Add another route (instead of /hot) for our custom hot topic listing.
- Or maybe the Discourse codebase can be improved to support such use case?

---

_[View the full topic](https://meta.discourse.org/t/how-do-you-customize-hot-topic-score-algorithm-with-a-plugin/396003)._
