# Topic Ratings Plugin

**URL:** https://meta.discourse.org/t/topic-ratings-plugin/39578
**Category:** Plugin
**Tags:** pavilion
**Created:** [February 14, 2016, 9:06pm UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578 "2016-02-14T21:06:53Z")
**Posts on this page:** 1
**Showing post:** 120

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [November 28, 2017, 1:07am UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/120 "2017-11-28T01:07:43Z")

</div>

Hey

> [@Tumi](#):
>
> It is possible to create a ranking of this ratings ?

Yes, it’s possible. In a separate plugin you could add a new topic list that sorts topics based on the `average_rating` topic custom field.

Here’s an example of how to create a new topic list that is sorted by a custom field:

- [discourse-events/plugin.rb at main · angusmcleod/discourse-events · GitHub](https://github.com/angusmcleod/discourse-events/blob/master/plugin.rb#L136)

> [@Tumi](#):
>
> i want to show on the sidebar Top 10 best rating topic from category X and category Y

Well, you’ll need a sidebar first. Then a widget that has a topic list in it. Here’s some I prepared earlier:

[https://github.com/angusmcleod/discourse-layouts](https://github.com/angusmcleod/discourse-layouts)  
[https://github.com/angusmcleod/layouts-topic-list](https://github.com/angusmcleod/layouts-topic-list)

So all you need to do is change the topic list in the layouts-topic-list widget to the topic list you created in your new plugin.

1. Follow the [beginners guide to creating a plugin](https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins-part-1/30515)

2. Add the layouts plugin with the topic list widget

3. Copy / paste the new topic list code I’ve linked above

4. Change a few variable names and urls in the topic list widget and the topic list code.

---

_[View the full topic](https://meta.discourse.org/t/topic-ratings-plugin/39578)._
