3

I need to list nodes both in the main site navigation and within a section side navigation. Is it possible to target a specific menu for the Pathauto module to reference?

This is an example of the two menu structure.

Main Nav:  
- Home
-- Page A
--- Page A Child 1
--- Page A Child 2
-- Page B

Page A Side Nav:
- Page A Child 1
- Page A Child 2

This results in Page A Child 1 and Page A Child 2 having /Page-A-Child-1 and /Page-A-Child-2 as respective paths.

What I want is for both menus to have /Page-A/Page-A-Child-1 and /Page-A/Page-A-Child-2 as paths.

The pattern I'm using is [node:menu-link:parents:join-path]/[node:title].

  • You are confusing two different concepts: paths and menu entries. A path can be in any number of menu entries (including none, which is most commonly the case for nodes). When a node is created a menu entry can be added for it, but not by pathauto, which only generates a path. If you want a second menu entry for the same node, then with Drupal out-of-the-box it has to be created manually. – Alfred Armstrong Mar 14 '18 at 16:37
0

You can create multiple path aliases for a single node, but you can not re-use existing path alias to point to different node.

If Child 1 and Child 2 in your example point to the same nodes, then I I am not sure if I understood your problem correctly, because you can create multiple menus to point to the same nodes. Let's say you created both child nodes associating them with Main menu checking on the Provide a menu link in node's Menu settings. Then you could just create a new menu on admin/structure/menu and add menu items for the same nodes replicating the same or creating new path aliases.

Another way is to let Pathauto generate whatever path aliases you want for the first menu, then programmatically copy its items and override the second menu items with theme_menu_tree().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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