0

I have a content page say content type "spl content" which has few related pages(added using field entity reference). when i create page in admin I can link multiple pages to my page using entity reference which i call in this specific case as related pages.

I have custom template for content type "spl content", here I get all the node ids of related pages but I want to access further details of the related pages.

Is it possible in twig template having path themes/custom/{themename}/templates/node--spl-content.html.twig to fetch details of related node?

I do get node ids of related pages by looping node.field_related_pages

{% for item in node.field_related_pages %}

{{item.entity.id}}

{% endfor %}

item.entity.id prints the node id of every related page. I need to have body content and other field of related page in this twig.

Any help is appreciated.

3
  • 2
    {{ item.entity.body.value }} {{ item.entity.field_name.value }}
    – No Sssweat
    Feb 28 '20 at 7:30
  • This should rather be a block display via a block reference field than done with templating.
    – leymannx
    Feb 28 '20 at 8:38
  • Yes that works thank you
    – Ekta Puri
    Mar 1 '20 at 21:57

Browse other questions tagged or ask your own question.