Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal Views: Get nodes with the same taxonomy as the current node

I have a Content-Type with taxonomy-terms. It's a select-list, so it can have only one taxonomy - at least of that vocabulary. Now I need to build a view that lists all nodes with the same taxonomy.

Thought that this wouldn't be too hard since it sounds pretty basic. Yet I can't get it working. Any ideas? I'm trying to avoid writing a module for this.

like image 255
nocksock Avatar asked Dec 10 '25 22:12

nocksock


1 Answers

While this was technically possible with Views 2 as described in some of the other answers, Views 3 has this integration built in.

You can create an argument for the taxonomy term id and then choose "Provide default argument". This will then give you an option for "Taxonomy Term ID from URL" and "Load default argument from node page..."

This will allow you to take the taxonomy of a page and pass that as an argument to your view block.

Note: Views 3 is currently in Alpha 3 but in my experience is at a relatively stable state and I am using it on production sites. If it has features like the one above that you find useful please use it, test it and submit bugs/patches if you encounter any issues!

like image 167
markdorison Avatar answered Dec 12 '25 19:12

markdorison



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!