Keep menu open for custom content entities I am writing modules that define content entities in Drupal 8. The Drupal console creates the menu items for the list builder. I would like the menu to stay open (having the menu-item--active-trail class) when I access the view or edit form page of, say, the content entity with id 4.

The breadcrumb navigation works perfectly out of the box, but the menu is completely closed for the content entity with id 4. 

I am ok with writing a Menu Plugin or using a contributed module.
My solution turned out to be the contributed module Menu Trail By Path: because I can fine-tune the actual URLs in all of my entities' YAML files, I can define the hierarchy easily.