How can I dynamically add URL or taxonomy to body class
The answer provided by mradcliffe was what I needed. One improvement that will yield a css-friendly class name is to use the Twig |clean_class filter. Here is the code:

In MY_THEME.theme

&lt;?php
function MY_THEME_preprocess_html(&amp;$variables) {
  $current_path = \Drupal::service('path.current')-&gt;getPath();
  $variables['current_path'] = \Drupal::service('path.alias_manager')-&gt;getAliasByPath($current_path);
}
?&gt;


In html.html.twig:

{%
  set body_classes = [
    logged_in ? 'user-logged-in',
    not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class,
    node_type ? 'page-node-type-' ~ node_type|clean_class,
    db_offline ? 'db-offline',
    current_path ? 'context' ~ current_path|clean_class,
  ]
%}
&lt;body{{ attributes.addClass(body_classes) }}&gt;


Don't forget to clear your cache!