Sub level menu in sidebar (but in specific pages) How can i display sub level menus in sidebar?

For example: I have a Menu 1 (M1) with SubMenus (SubPage 1, SubPage 2, SubPage 3, SubPage 4) and I want that submenus displaying in sidebar just when clicked in Menu 1 (M1) and other submenu associated with menu 1.

And, when clicked in Menu 2 (M2), I want to display just the Submenus associated to Menu 2

Example image

:

Thank you in advance
This is exactly what Menu block does. You can set up blocks showing menu items according to the start level and depth you desire/configure. Those blocks show only up when there are menu items in that range so you even don't need to configure your blocks to only show up on certain pages. See the documentation for further information.

To be more concrete, your menu (main_menu for instance) should looks like:


Page 1

Subpage 1.1
Subpage 1.2
...

Page 2

Subpage 2.1
Subpage 2.2
...

Page 3


Set up a menu block that shows the second level and configure that block to show up in second sidebar. With this configured you'll see a menu showing Subpage 1.x when on Page 1 or on one of its subpages. The same counts for Page 2. When on Page 3 you won't see the menu in the second sidebar.