How to make twig rules based on paths?
Put the route name in a variable in preprocess

mytheme.theme

function mytheme_preprocess_page(&amp;$variables) {
  $variables['route_name'] = \Drupal::service('current_route_match')-&gt;getRouteName();
}


and use it in twig:

page.html.twig

{% if route_name == 'entity.node.edit_form' %}
  This is a node edit form.
{% endif %}