Comparing node creation and modification dates in twig
You can't compare render arrays. To compare fields better use raw values stored in the node:

{% if node.getCreatedTime &gt; node.getChangedTime %}
    ...
{% endif %}


(The comparison doesn't make much sense, probably you want to swap both dates)

The node object is available in node and page templates. In other templates you might find it in a deeper level. If not and the node is displayed as main content you can add it in preprocess:

  if ($node = \Drupal::routeMatch()-&gt;getParameter('node')) {
    $variables['node'] = $node;
  }