I have a content type with an entity reference field that allows users to assign multiple other nodes to be referenced from the current node.

I am trying to create a view that will list the related nodes for the current page.

What Relationship/s and contextual filters must be set to achieve such a thing?

I have read a number of other posts asking similar questions, though most seem to be in reference to Drupal 7 and their suggestions either do not work, or appear to not exist in Drupal 8.

I can get a list which shows all the other nodes that reference the current node by setting a contextual filter to: Content:field_related_pages and setting the default value to Content ID from URL this, however, is the exact opposite of what I want...

I have tried creating a relationship based on the Entity Reference field, however there are two options I can see:

  • Content referenced from field_related_pages
  • Content using field_related_pages

I have also tried using a contextual filter of: Content: ID with the default value set to Content ID from URL

I feel like I have attempted every conceivable combination of the above and none seems to work. Can someone please put me out of my misery and incompetence and please how to get a contextual filter to show a list of nodes related to the current via a entity reference field?

1 Answer 1


Apparently I had the following selected under the "more" tab in the contextual filter:

Exclude If selected, the numbers entered for the filter will be excluded rather than limiting the view.

Which lead to all kinds of odd behaviour...

If it is of use to anyone else, the correct answer appears to be:

  • Content using field_related_pages with the relationship required.
  • The contextual filter set to Content: ID with with the ```default value set to Content ID from URL`` and
  • Relationship dropdown set to the field_related_pages

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.