Every time I think I understand relationships… Got desperate and cannot make work following context:

A node has a reference (field_a) to a term 1A of vocabulary A. That term 1A itself has a reference (field_b) to another term 1B of vocabulary B.

vocabulary A > vocabulary B





NODE 1 > TERM 1A (> TERM 1B)

NODE 2 > TERM 2A (> TERM 2B)

NODE 3 > TERM 3A (> TERM 1B)

NODE 4 > TERM 4A (> TERM 2B)

On the node page I would like to have a block that shows all nodes that have the same (term) grandchild relationship to 1B (respectively 2B or any term of vocabulary B).

Or schematically (adding other cases)

BLOCK on NODE 1 PAGE shows related NODE 1 and 3

BLOCK on NODE 2 PAGE shows related NODE 2 and 4

BLOCK on NODE 3 PAGE shows related NODE 1 and 3

BLOCK on NODE 4 PAGE shows related NODE 2 and 4

Could someone please give my a hint?


You can start with Content Views that show all nodes tagged with term from Vocabulary A, then add relationships to Taxonomy information, including the reference between terms from vocabularies A and B, and the one introducing content tagged with those terms.

  1. Create a new Views of type Content showing Fields, add a Block Display to the View, change its name to something meaningful you can recognize later on Blocks page
  2. Add a Filter to limit to your desired Content types
  3. Add a new Relationship Taxonomy term referenced from field_a and Require this relationship

    This one merely introduces more information about the Vocabulary A term that the current node is referencing.

  4. Add a new Relationship Taxonomy term referenced from field_b, make it use the first Relationship and Require this relationship

    This one introduces information about the term from Vocabulary B that is referenced by the term that node is tagged with.

  5. Add a new Relationship Taxonomy term using field_b, make it use the second Relationship and Require this relationship

    This one goes reverse, back from Vocabulary B to terms from Vocabulary A that reference specific term from B

  6. Add a new Relationship Content using field_a, make it use the third Relationship and Require this relationship

    This one introduces nodes that are tagged with terms from A that also reference term from B that is referenced by term from A that the current node is tagged with.

  7. Add a new Contextual filter ID from Content Category and configure:
    When the filter value is NOT available
    Provide default value
    Content ID from URL
    When the filter value IS available or a default is provided
    Specify validation criteria
    [your relevant CTs]

    This one just gives Views information about the current node.

  8. Edit the Content: Title Field you already have and make it use the fourth relationship (it will actually be the only one available). Now the Title won't be showing the Title of the current node, but the Title of the node that is related to the current node through A > B > A "relation path".

You should now see a list of nodes related to the current node through the "grandparent" term.

  • Wow. I do not know if I would have figured that out ever. Thank you so much. – Benjamin Sep 23 '18 at 12:40
  • Although you answered my question 100%, I have an additional question to this topic, on how to continue after step 4 if I would like to show the nodes of another content type that references directly field_b/vocabulary B. But I will try to figure that out by myself first. – Benjamin Sep 23 '18 at 13:01
  • It takes some learning and trying things out but it doesn't take that long once you realize relationships just connect different tables in the database. You already have B terms available through step 4, now you add relationship Content using field_c to introduce those nodes into View. To test showing them edit the Title Field and change it to use that Relationship. You should now see only the nodes referencing B term that is the grandparent to the current node. With that working, you need to combine the 2 solutions, but that isn't so easy. Can you use two blocks one below the other? – prkos Sep 23 '18 at 14:54
  • I did not manage it, but I think that it was not very clever give the field in the nested term the same name as the reference field in the nodes of the other content type. Nevertheless, if it is in anyway complicated to combine the 2 solutions easily (I imagine because of need of usage of "Require this relationship"), I will use it that way. You made me very happy with the upper solution in anyway - the other thing would only be the cherry on the cake. (The only solution I found before was displaying the field ID in the path) – Benjamin Sep 23 '18 at 16:08
  • If you have reused the same Term reference field in two content types that can actually make things easier in Views, depending on what you're trying to achieve. You can unrequire any Relationship, the first solution will still work. You may get it to work if you play with it, try to combine it. I don't have your structure replicated so I can't test, it's hard to imagine what the outcome might be. You can add another Title field, make it use the last Relationship while keeping the old Title field, that might list all the nodes, but there may be repetition, and they will show in the same row... – prkos Sep 23 '18 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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