Div id in Drupal menu items

81 Views Asked by At

In Drupal main menu I am creating a menu item. In the path field I want to specify div id instead of path of the node. Is this possible.

2

There are 2 best solutions below

0
Paradoxetion On

Yes and no. You couldn't do just #divid, in path, but you could node/19#divid and even <front>#divid if needed.

0
Nathan Plowman On

This wouldn't be possible out-of-the-box, but you should be able to pull it off by using the Menu Token module. https://www.drupal.org/project/menu_token

Once you enable the module, you can use a token in your path for the current page, and then append your fragment to it. For example: [current-page:url]#your-element-id