Module Description
Menu Trail By Path sets the active-trail on menu items according to the current url.
For example if you are at yoursite.com/blog/category1/article1 Menu Items with these paths will get the active-trail class on them and expand accordingly.
blog blog/category1 blog/category1/article1
This is particularly useful if you want a lot of nodes to appear as children of certain nodes / taxonomy term / views / referenced nodes / etc, but do not want to add them all to the menu. eg. hundreds of blog articles.
Menu Trail By Path is best used in conjunction with Pathauto.
This module is similar to Menutrails (D6) and Menu Position (D7), except no configuration is needed. It uses the path URL to determine the active-trail instead of setting rules for each node type. It also works for non-node pages such as taxonomy term and views. Just enable the module to see the results.
Drupal 8
* Make sure to use a "menu.html.twig" like the classy-theme (or use that as base theme, like bartik does), stable-theme and stark-theme will not add the classes that you propably will expect, see "No active trail class gets added"-issue.
* The module now has some settings for performance optimizations, see release notes for 8.x-1.2
Drupal 7
* can also handle breadcrumb by path
For example if you are at yoursite.com/blog/category1/article1 Menu Items with these paths will get the active-trail class on them and expand accordingly.
blog blog/category1 blog/category1/article1
This is particularly useful if you want a lot of nodes to appear as children of certain nodes / taxonomy term / views / referenced nodes / etc, but do not want to add them all to the menu. eg. hundreds of blog articles.
Menu Trail By Path is best used in conjunction with Pathauto.
This module is similar to Menutrails (D6) and Menu Position (D7), except no configuration is needed. It uses the path URL to determine the active-trail instead of setting rules for each node type. It also works for non-node pages such as taxonomy term and views. Just enable the module to see the results.
Drupal 8
* Make sure to use a "menu.html.twig" like the classy-theme (or use that as base theme, like bartik does), stable-theme and stark-theme will not add the classes that you propably will expect, see "No active trail class gets added"-issue.
* The module now has some settings for performance optimizations, see release notes for 8.x-1.2
Drupal 7
* can also handle breadcrumb by path
Module Link
Project Usage
27789
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
Menu Trail By Path sets the active-trail on menu items based on the current URL, making it easier to navigate through a large number of nodes without adding them all to the menu.
Data Name
menu_trail_by_path