To check the field I use the following code:

{% if content.field_name|render is empty %}

How to check on node.twig if {{ my_cool_view }} result is empty? Is this generally possible in Drupal 8? Thank you for help.


You can use twig_tweak Module, and use drupal_view_result extension like:

{% if drupal_view_result('who_s_new', 'block_1') is empty %}

For more info look at this module Cheat sheet

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.