Drupal - How do I add a hash link in menus?

Unfortunately as far as I am aware, Drupal cannot do this out of the box. However, you can use the Special menu items module to create a new menu item, and place "nolink" in the path settings.


Follow what reported in a comment for the l() documentation.

To create a link to a named anchor (e.g. "#namedanchor"), you will need to use a small work-around.

l('linktext', '', array('fragment' => 'namedanchor', 'external' => TRUE));

To create a hash-only link (to "#"), you'll need to adapt it to:

l('linktext', '', array('fragment' => ' ', 'external' => TRUE));

(Note that the fragment does contain a space.)

 

In Drupal 7, set "HTML" to TRUE, then append the hash character.


http://drupal.org/node/123103#comment-4955236

node/16#gohere

the auto url will change it to be like

about-us#gohere

Tags:

Routes

7