I created a view "Blog Listing Cards" [machine name: blog-listing-cards] I created a views view fields template [views-view-fields--blog-listing-cards.html.twig] The template is properly 'picked up' and the static content displayed.

However, any time I try to print a field in the template, whether a Drupal default or custom field, it doesn't render in the browser.

The syntax seems correct when compared to documentation, other templates, and others with the same issue.

Examples of code not rendering

<div class="entry-meta">{{ fields.created.content }}</div>

<h2 class="display-4 mb-4 text-light">{{ fields.title.content }}</a></h2>

What am I missing?! Sorry, I'm a Drupal 7 guy re-learning in Drupal 8. Thanks in advance :-)

screenshot of view

  • Honestly, this is probably easier done as a view mode (display) then just telling the view to output that instead, unless I am missing some requirement of the view.
    – Kevin
    Apr 5, 2018 at 14:25
  • There is a NID Contextual Filter that I believe necessitates a view? The reason i'm doing this in the first place, rather than just using the default view output, is because I need a dynamic background image and you cannot put style tags in Drupal's text editor to simply use Replacements in the view itself. So I believe I need to send it to the template engine for processing - hence the view template. Ugh.
    – DJ Monzyk
    Apr 5, 2018 at 14:28
  • What? You can change the 'Show' under Format to "Content" and then select the view mode. Then you don't have to mess with fields. Then you can theme the node normally with a twig template, and the view will output that. That gives you the ability to preprocess in mytheme.theme.
    – Kevin
    Apr 5, 2018 at 14:41
  • add {{ dump(_context | keys) }} to your template file to see what's available, are you sure it's fields? I've never worked with that particular template file before so cannot say precisely. I agree with the other comments. I would set the view to display content under "format" settings. Set it to use whatever view mode of your content type you want, then work with template files there such as node--my-content-type--view-mode.html.twig Apr 5, 2018 at 14:52
  • Thank you everyone, you are right, that is another method to theme and I learned an alternate way which is always good.
    – DJ Monzyk
    Apr 5, 2018 at 16:41

1 Answer 1


The problem is because those fields are hidden in the view and {{field.<field-name>.content}} will be empty.

  • 1
    Wow, I'm so embarrassed. You are right, I had the fields hidden. I originally was aggregating and writing the view's output in a Global custom text field. I had hidden the fields so they wouldn't be displayed in the UI. Once i realized that I needed a background image, and cannot use a style element in custom text field, I opted to try the template. Not realizing that hiding a field doesn't JUST hide it in the UI, but also in the templating engine. Thanks for clarifying! Works great now.
    – DJ Monzyk
    Apr 5, 2018 at 16:44
  • If you are happy, please accept the answer..
    – Sensimple
    Apr 5, 2018 at 17:44

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.