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.

1 Answer 1


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

  • Extra tip: you can add argument too, like drupal_view_result('who_s_new', 'block_1', 'all'), this is useful if you render with argument elsewhere the check is wrong Commented Feb 21, 2022 at 13:41

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.