14

In Drupal 7, I've got a content type called "Asset" with a taxonomy field called "Category". All I need is a Block on the Asset pages that looks at the current node's Category term(s), finds all other Asset nodes tagged similarly, and spits out a list of their titles, links to them, and a few other bits of info from their node.

A Views Block was my first thought... but I'm having a heck of a time making this happen in Drupal 7. Maybe it's problematic because my URL doesn't include the Term ID? Anyway, I've searched and followed a bunch of tutorials (like this one and this one), but to no avail. So, here are my questions:

  1. If Views is the answer, what am I doing wrong?
  2. Is there a Drupal 7 module that can do this for me?
5
  • 3
    The first tutorial you listed should do exactly what you wish. (Forget the second one!) If you are not able to get it to work, it just means you are not understanding. Have another go, and see where you can take it.
    – Triskelion
    Mar 8, 2013 at 2:57
  • @Triskelion, I'll surely give it another go... but I followed it precisely!
    – Sam
    Mar 8, 2013 at 3:12
  • Once you have the view, let me know what problems you are having.
    – Triskelion
    Mar 8, 2013 at 3:13
  • With a little tweaking... IT WORKED! I'm at the refining stage of the Views build process, so it's not perfect, but it's getting there. I'll be honest, I don't really understand the Aggregation part.
    – Sam
    Mar 8, 2013 at 15:59
  • This answer on StackOverflow did the trick... with a little tweaking: Creating list of similar nodes in Drupal 7/Views 3
    – Sam
    Mar 8, 2013 at 16:00

1 Answer 1

33

I've done a little tweaking myself, and I seem to have gotten a working solution here.

  1. Create a new block for the nodes you'd like to display
  2. Add a new Contextual Filter: Content: Has Taxonomyterm-ID Select: "when the filter is not available, provide a default value: Taxonomyterm-ID from URL." Put a check next to "Load Standard Filter from node-page, useful for related taxonomyblocks" And you will probably want to limit the vocabulary as well

In order to exclude the current Node you have to add a second Contextual Filter for Node-ID, provide default value as the content ID from URL and at the bottom of the modal pop open 'More' and check 'Exclude'

4
  • Brilliant answer. Just what I was looking for!
    – cwiggo
    Mar 1, 2016 at 11:20
  • But it matches only with first term available in that node, how to match with all? Sep 27, 2016 at 11:36
  • 5 years later, this answer is still relevant, concise and most importantly flawless. Thank you!
    – WebMW
    May 26, 2018 at 21:20
  • 7 years later, +1
    – Ejaz
    Apr 2, 2020 at 23:42

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