3

I am trying to build pages with the main menu displayed in multiple locations. A "main navigation" with top-level items A,B,C,D,E; and each of these has children a1,a2,...b1,b2,... etc.

There is a drop-down navbar menu in the header that is on every page (that displays A B C D E and when you click on any one of them, it shows its children); if you click on any child (say a2), it takes you to a url .../A/a2. That page still has the "main navigation" in the header, but also in the left sidebar it has the sub level menu of A (a1,a2,a3...) with a2 highlighted.

Someone directed me to try the menu block module, but i am not able to get it to display just A's children while in A. Depending on the options I choose for depth etc. I can either show all links (A B C D E a1 a2...e1 e2...) or all the children from all the parents (a1,a2,...,b1,b2,...,e1,e2...).

Using twig debugging, I see it's using the same template as the navbar drop-down menu, so I can't write a separate template either (or can I?)

1 Answer 1

1

Ok, I sorta figured this out. It might be a hack, but if I start with initial menu level: 1, maximum menu levels to display: 1 and fixed parent item to be the menu who's children i want displayed, then it sort of works.

Only caveat is I need to make a separate block for each separate child of the menu. Plus, it is still using the same template to display the menu in both places (header + sidebar). Perhaps using custom blocks and changing its name will generate a new template?

I'd love to hear a better answer if there is one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.