I want to show related nodes to the current node in a block using taxonomy terms. In my site say x is my taxonomy vocabulary and x1,x2,x3,x4,x5,x6 and x7 are the taxonomy terms under it. A node could be tagged with any of these taxonomy terms. Say node T is tagged with x2 and x3. node W tagged with x3, x1 and x5. node c tagged with x2 and x6. node R tagged with x2 and x7. F tagged with x4,x6. H tagged with X2,x5. Now when the node T is displayed I want items having any of the taxonomy terms similar to the current node i.e. X2 or x3 but the priority should be x2 i.e. list all the related nodes with x2 as tag first and then only with x3. so in the above case i need related nodes in the order C R H W? How is it possible by using views in drupal 7?


1 Answer 1


There will be a significant amount of customization (in the form of a module) to get this done through views. I've created a sandbox module that you can install to get things working and so you can play around with it (see views.api.php in the views module).

Once enabled you should find a new contextual filter value called "The node whose taxonomies you want to relate". This contextual filter default will take the current node ID and return nids of nodes that share the same terms in vocabularies that you select. Therefore, please set the view display as a block.

If you need to know how to group by term using views, please see this answer.

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.