I have two content types: departments and teachers. Every teacher node has an entity reference field which points to the department to which that teacher belongs.

I want to create a view that shows the list of all teachers from the particular department and I want the link of that view to be shown on the department page. So, each department page will have a link of a view page which will show the list of all teachers from that department.

I can create a view for a content type, but how can I create a view for a specific node of a content type (e.g Computer Engg department)?

1 Answer 1


It sounds like you want to put a teacher tab on a node page of type department.

Create a view that shows content (nodes). Filter it to only show teachers. Add a relationship to the department.

Add a contextual filter of nid, and set the relationship (to department) you created on that contextual filter. Hide the view when the filter value is not available, and add validation to it that confirms that it is a node nid belonging to a department.

Add a path to the view: node/%/teachers. Add a menu entry. Set it to menu tab, and give it a title of 'Teachers'.

  • Hey Thanks for the answer..Can you please explain it in more detail? How do I create that view? ..I don't have much experience with drupal.Thanks Dec 1, 2014 at 11:43
  • I tried your answer basically it uses contextual filters to show all the teachers from that particular department but I want to create a separate page for each department how can I do that? Thank you Dec 5, 2014 at 2:01
  • Explain what you mean with 'separate page', because 'node/%/teachers' is a separate page already. Dec 5, 2014 at 6:39
  • Actually I am a bit confused about how to actually create the view..can you please provide me the links to some video or something where I can actually see this! I am a newbie :p... thank you! Dec 9, 2014 at 16:10
  • There are many tutorials, but the best IMO is Taming the Beast: Learn Views with NodeOne no. 21 and 22 Dec 10, 2014 at 3:18

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.