<p>You can use the <a href="https://plugins.craftcms.com/similar" rel="nofollow noreferrer">Similar plugin</a> for this. I don't know that you can do it natively otherwise.</p>

CC BY-SA 4.0
2019-11-01T08:01:09.793Z
Thanks Jeremy - I'll take a look
Clifford
CC BY-SA 4.0
2019-10-29T03:28:54.380Z
2019-10-29T03:28:54.380Z
Jeremy Gimbel
<p>I'm creating a list of similar entries which displays entries that share the same categories as the current entry. My code looks like this:</p>

<pre><code>{% set categories = craft.categories.relatedTo(entry) %}
{% set entries = craft.entries.section('projects').relatedTo( categories ).id('not ' ~ entry.id) %}
{% for project in entries %}                    
    &lt;a href="{{ project.url }}"&gt;{{ project.title }}&lt;/a&gt;&lt;br/&gt;
{% endfor %}
</code></pre>

<p>Many of my entries have multiple categories. Is it possible to order the list so that entries with the most categories in common with the current entry are at the top? And if not, is there another solution that would do this?</p>

<craft3><categories>
Order related entries by number of categories they have in common with current entry
# Order related entries by number of categories they have in common with current entry

(Asked by: username_0 on 2019-10-20)

I'm creating a list of similar entries which displays entries that share the same categories as the current entry. My code looks like this:
{% set categories = craft.categories.relatedTo(entry) %}
{% set entries = craft.entries.section('projects').relatedTo( categories ).id('not ' ~ entry.id) %}
{% for project in entries %}                    
    {{ project.title }}
{% endfor %}

Many of my entries have multiple categories. Is it possible to order the list so that entries with the most categories in common with the current entry are at the top? And if not, is there another solution that would do this?

**Tags:** craft3, categories


---

## 1 answers

### Answer by username_1 on 2019-10-29. Score: 0 | Accepted answer

You can use the [Similar plugin](https://plugins.craftcms.com/similar) for this. I don't know that you can do it natively otherwise.

> **Comments:**
> **username_0**: Thanks Jeremy - I'll take a look  

---

