Add content type machine name as body class
The code sample from your question could be extended to look like that:

function marienschule_preprocess_html(&amp;$variables) {

  $node = \Drupal::routeMatch()-&gt;getParameter('node');
  if ($node instanceof \Drupal\node\NodeInterface) {

    // Add node ID body class.
    $variables['attributes']['class'][] = 'node-' . $node-&gt;id();

    // Add content type machine name body class.
    $variables['attributes']['class'][] = 'node-type-' . str_replace('_', '-', $node-&gt;bundle());
  }
}