I have two content types: Article and Magazine. in Article there's an entity reference field to Magazine, field_related_magazines.

On my website, when an article is shown, I would like to show a list of related articles that share the same magazine.

When I make a new article, I can choose the magazine edition in which the article appeared. Then, on the bottom of the node page, all other articles should be listed.

The thing I tried:

Make a views block 'Magazine related items' that lists Article titles and place the block on the Article pages.

Set the context for the block to work: Advanced>Contextual Filters>Content ID>Provide default value>Content ID from URL

Set the relation: relationships>Content using field_related_magazines (relate each Content with a field_related_magazines set to the content item.)

However, this only shows the current articles' title, not the titles of all other articles that share the same magazine. How would I get all the others?

1 Answer 1


In order to fetch resources under specific Megazine, you need to have the Magazine ID on your contextual filter instead of the Article ID. Here is my suggestion:

Play with your URL pattern to add the magazine ID to it (You can do this using Pathauto and Token Module). Once you install those two modules define a URL Pattern for your articles (/[node: field_related_magazines:entity]/[node:title])

Now you each article page will have a URL with Magazine ID to it so, you can change your contextual filter to get Magazin ID from the URL using "Raw Value From URL". This will give you the result you are looking for.

  • Thank you, could you explain this somewhat further? I already use Pathauto and Token so that's nice. I tried to define a pattern with the ID of the related magazine, but the token [node: field_related_magazines:entity] you proposed is not available. Just [node: field_related_magazines] which gives the title of the magazine (I think). Then I tried to use that in the view pulling it with 'raw value from url', but with no luck.
    – C.A. Vuyk
    Commented Feb 6, 2020 at 7:34

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.