(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
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.
-
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.– AtriumCommented Jan 10, 2017 at 6:59
-
1Ah your content isn't being displayed yet? When you go to
Manage display
, can you change theFormat
toRendered 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– AtriumCommented Jan 10, 2017 at 8:45