I have two types of nodes: News and Page. Every News node can be assigned to a category (taxonomy term), which is used also from the Page nodes.

I would like to get in a view all the News nodes that have the same category the current node has.

How can I achieve this?

  • I can't do it for you, so no answer, just a hint: experiment with relationships.
    – Mołot
    Commented Jul 8, 2013 at 13:59
  • I tried to do it that way, but there is no expected results.
    – deem
    Commented Jul 8, 2013 at 14:05
  • I don't have time to try from scratch, but if you'll add what you tried to your question, I might be able to spot mistakes. And if not me, then someone else.
    – Mołot
    Commented Jul 8, 2013 at 14:07

3 Answers 3


Add CONTEXTUAL FILTER (Earlier arguments) on CONTEXTUAL FILTERS section on views click add, select "Content: Has taxonomy term ID" and in "WHEN THE FILTER VALUE IS NOT IN THE URL" choose Provide default value. Choose "Taxonomy ID from URL" check "Load default filter from node page, that's good for related taxonomy blocks". It will create a related taxonomy.

  • I did it and no results. My node link is "localhost/page-slug".
    – deem
    Commented Jul 8, 2013 at 17:34
  • Make sure you have shared taxonomy.
    – heshanlk
    Commented Jul 8, 2013 at 17:49

If your goal is to show a list of News nodes on a Page node that share a given taxonomy term, then you can do this:

  • Create a Taxonomy Reference field on the Page content type. If you prefer, you could create an Entity Reference field instead.
  • Assign the same taxonomy reference field to the News content type.
  • Create your view. Add fields and filters to your view from the News Content type.
  • Add Has Taxonomy Term ID as a contextual filter.
  • Under When the filter value is not available, choose Taxonomy term ID from URL. Enable Load default filter from node page, that's good for related taxonomy blocks, and Limit terms by vocabulary, then choose the shared vocabulary.
  • Under When the filter value is available or a default is provided choose Specify validation criteria. Set the Validator Term to Taxonomy Term and choose the shared vocabulary.
  • Under Filter value type choose Term name converted to term ID.
  • Under Action to take if filter value does not validate choose Display all results for specified field.
  • Test by previewing with the NID from a Page node that shares a vocabulary term with at least 1 News node.

Note that this approach does not require any Relationships in the view. There are a lot of posts that deal with similar problems that add one or two relationships to the view, but they aren't needed here and, even if they work, are a lot more complicated and slower for Views to execute.

  • This was really helpful, I'll add that I couldn't test the preview with the page node ID but it worked with the ID of the taxonomy term instead. Commented Mar 18, 2022 at 14:01

Please check the below link: Related content in drupal 7

You need to create a view and add a contextual filter to display the nodes based on the particular taxonomy term from the currently active node.

Make sure you are not having the views filter for one particular node type.

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.