Way to display those nodes in a view that are rela

2019-08-31 11:32发布

问题:

I have two content types - "Blog" and "News". I am using a reference field to relate blog nodes to news nodes. Now, for the news landing page, I need a block view that displays "Related blogs" i.e. it lists blogs that are related to any news node.

The news landing page is a panel page with a main view that lists all news nodes. The "Related blogs" block will be placed below the main block.

Is there a way to achieve this "Related blogs" block using views?

I am using Drupal7 and I am free to use any module for the relations, apart from references.

回答1:

Just create a new view, add the reference field as a relationship, and the NID as the contextual filter. Also set the contextual filter to Provide a default value and choose Content ID from URL. The add the block to your news pages.