0

(Drupal 8) So I have a content type called Browse, then I have created a paragraph which is a entity reference field for content of Blog. So now when I create a piece of content in Browser I can add multiple blog posts to this page with the entity reference field from paragraphs. I can not figure out how to render the blog data into my twig template. Maybe I am using the wrong twig template file? I am trying with a field--paragraph--blog.html.twig. Does this need to be done in the theme_preprocessor?

1 Answer 1

1

You can enable Twig Debugging in sites/default/services.yml. If services.yml does not yet exist; copy default.services.yml and rename it to services.yml.

Set the debug variable to true:

parameters:
  twig.config:
    debug: true 

Now clear cache and refresh your page. Look in the html source and you should see some template suggestions.

3
  • I have that enabled but that doesn't help me figure out how to display a rendered blog from the entity reference field. I already have the twig template that I am using. And it works. But can't display the rendered blogs on this page.
    – Atrium
    Commented Jan 10, 2017 at 6:59
  • 1
    Ah your content isn't being displayed yet? When you go to Manage display, can you change the Format to Rendered entity? Commented Jan 10, 2017 at 7:03
  • That is not an option. Just says Field--------Label-------Format Blog Reference----> Above---->Label Link to the reference entity
    – Atrium
    Commented Jan 10, 2017 at 8:45

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.