How to create a view which would list related content for current article? I try to create a view which would list related content (some articles) to a content type article.

Here is what i’ve done. I’ve created a field "Entity reference"  in the content types "Article". It works. I can see in database the related article ID .



Then, I create a view with a block. It works, i can see all articles listed in that view (which is visible on each article).

Here is my issue. I need to display only articles related to the current article. So, in contextual filter, i have tried with 
Content: ID and also tried with advanced/Relationships but without success. I don’t see my related articles.







How can I do ?

I’ve also tried a different way (create a twig) and even if it works, it is not the best solution i think
Ignore using fields in the View. This has been and will always be problematic IMO for 95% of Views people are making.



You need the Content ID argument from the URL so the correct node is selected, but here is where it takes a turn:

Set the view to show "Content" and give it a view mode, for instance, create a view mode called "Related Content" for nodes. In the field display for that view mode, only set the "Related Articles" field to be visible. Set its field formatter to "Rendered Entity", and create a view mode for that content type and theme it. On that content type, you would have title and body, or whatever fields you want to show (hard to tell without seeing a design).

Now the View will pull the node, render it, and in turn render the nodes that are being referenced in a view mode. 

Then, you would get something like this, for example:



That is a View that looks at the current node, and renders it. The view mode has a field (Related Content), which is a node reference, and those nodes are rendering in a "Preview" view mode - and this is the result. All of the markup lives in two twig files (for the node--node-type--view-mode.html.twig) and the Views configuration is super simple.

The Views display would be a block, and you can place that block in whatever region works for you.