Oct 14, 2020 in Drupal 8

 

/**
 * Implements hook_preprocess_node().
 */
function MYTHEME_preprocess_node(&$variables)
{
  $variables['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
}

No, in my node--page.html.twig I can use:

{% if is_front %}
// Do something
{% endif %}