I want to create a view block with related content based on shared terms. For this I created a term reference field inside the content type and created a views where I use a contextual filter Taxonomy term - ID to fetch all nodes sharing the samen terms. I also added a contextual filter to excluded the current node using Content: ID.

This all works great, but I now want to sort the view by the number of sharing terms. So the nodes with the most shared terms should end up on top.

I found these two articles: Create a related content block which sorts the nodes of related content by how many tags they share? Sorting view results by the number of matched arguments (contextual filters)

Following these two I enabled aggregation and for testing purposes I added the taxonomy reference field and used the aggregation setting count distinct.

Doing this the number of distinct terms is count instead of counting the number of shared distinct count. What step am I missing here?

1 Answer 1


The difficulty about this was finding the right way to search for a solution. But I found it. It's a module that does exactly what I want. It's called Similar By Terms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.