Set active trail in hook_preprocess_node For some content type, I need to attach my node to a parent menu item. I don't want to do that with UI (because too many nodes).
I saw something like that for Drupal 7 (works in a preprocess):

menu_tree_set_path('main-menu', 'my/parent/path');


Do you know a way to do that with Drupal 8 (menu_tree_set_path seems undefined) ?
The menu active trail is defined by the menu.active_trail service. Unfortunately it doesn't use a tag based extension like breadcrumbs.

You can replace that service and in case you detect that you're on a patch displaying a certain content type, return your desired structure.

You could also try out the https://www.drupal.org/project/menu_trail_by_path module, which defines the active trail based on the aliased path, like breadcrumbs do by default.