How to count number of published nodes of a specific content type in twig template?
In a preprocess hook function for your template, you can code something like this.
function MYTHEME_preprocess_TEMPLATE_HOOK(&amp;$variables) {
    $query = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;getQuery();
    $query-&gt;condition('type', 'promotions');
    $query-&gt;condition('status', 1);
    $query-&gt;range(0, 1); // only need one
    $results = $query-&gt;execute();
    $variables['has_published_promotions'] = (bool)count($results);
}

has_published_promotions will be available in your Twig template and will be TRUE only when there are published nodes of that type.