Add attributes to a template based on current node
In Drupal 8 you can get the node object from the routing system:

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