How to make twig rules based on paths? I want to make some rules in twig based on current page path. To be precise I want to make the page template look a little different when node is in edit form, revision history page and translation overview.

I want to do something like this, but doesn't seem like working;

{% if path('&lt;current&gt;') is path('entity.node.edit_form') %}


I want to make rules for all these paths;

entity.node.edit_form
entity.node.version_history
entity.node.revision
entity.node.content_translation_overview
entity.node.content_translation_add
entity.node.content_translation_edit


Are all available at any page template where a node will be rendered?
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 %}