how to check messages exists I want to check is there any messages in my template 
in drupal 7 there was a global variable in page template variables messages

now in drupal 8 I want to check  is there any message  but messages variable in page--front.html.twig is always empty, alternative way is check  region highlightes( because  status messages block is in highlighted region) 
but below  statement always return TRUE, 

    {% if page.highlighted %}
      {% block highlighted %}
        &lt;div class="highlighted"&gt;{{ page.highlighted }}&lt;/div&gt;
      {% endblock %}
    {% endif %} 


is there any way to check that messages exists in page in drupal 8?
While the page.highlighted variable contains the block data (mytheme_messages) for message display, the block rendering data doesn't contain the messages themselves, so there's no way to check for message existance there.

However, you can inject a custom variable based on the current message queue from drupal_get_messages(). 

For example, in your MYTHEME.theme:

/**
 * Implements hook_preprocess_page() for page.html.twig.
 */
function MYTHEME_preprocess_page(array &amp;$variables) {
  // Inject a flag based on the current message queue.
  $variables['available_messages'] = !empty(drupal_get_messages(NULL, FALSE));
}


And within your page.html.twig:

{% if available_messages == true %}
   &lt;!-- TODO: Add custom markup when there are messages --&gt;
{% endif %}