Create template suggestion for item-list.html.twig I have to change the markup and I have to add CSS classes to themes/classy/templates/dataset/item-list.html.twig. But only for a specific item-list.html.twig in a specific block.

How do I create a preprocess function, which create a template suggestion for this item-list.html.twig? So I am able to use e.g. item-list-facets.html.twig?
I think it's better to use hook__theme_suggestions_HOOK_alter:

Something like this:

 /**
 * Implements hook__theme_suggestions_HOOK_alter().
 */
function MYTHEME_theme_suggestions_item_list_alter(&amp;$suggestions, $variables) {
  $suggestions[] = 'item_list__' . str_replace('-','_',$variables["attributes"]["id"]);
}


Just make sure that in your suggestions name you use _ instead of -, otherwise you will get suggestions in the debug, but Drupal won't use it.