This simple module allows you to specify some additional attributes for menu items such as id, name, class, style, and rel.
You should use this module when:
- You want to "nofollow" certain menu items to sculpt the flow of PageRank through your site.
- You want to give a menu item an ID so you can easily select it using jQuery.
- You want to add additional classes or styles to a menu item.
The module currently allows you to set the following attributes for each menu item or menu link:
- id
- name
- target
- rel
- class
- style
- accesskey
For further information please visit the following:
- For a full description of the module, visit the project page: https://drupal.org/project/menu_attributes
- To submit bug reports and feature suggestions, or to track changes: https://drupal.org/project/issues/menu_attributes
- To install the module copy the 'menu_attributes' folder to your /modules directory.
- Navigate to Administer > Extend* or admin/modules. Check the 'Enabled' box next to the module and then click the 'Save Configuration' button at the bottom. Read more about installing modules in Drupal 8 at https://www.drupal.org/documentation/install/modules-themes/modules-8
-
Go to admin/people/permissions. Filter for the ‘Menu Attributes’ section. Set appropriate permissions.
-
Go to admin/structure/menu/settings. Review instructions on this screen.
-
Go to admin/build/menu
-
Select the menu links you want to edit (In this example we will edit the menu 'Navigation’).
-
Under operations for that menu, click ‘list links’.
-
Click on any 'edit' link under the 'Operations' column.
-
Scroll down the page to find the 'Menu link attributes' and 'Menu item attributes' sections. Expand either section by clicking on it.
a. Menu link attributes are added to the
<a>
link element. Follow instructions on screen.b. Menu item attributes are added to the
<li>
list element for that link. Follow instructions on screen. -
Click the 'Save' button.
Another way of setting menu attributes is to edit any page, scroll to 'Menu settings' and click the checkbox for ‘Provide a menu link’. This will reveal the options for this menu item, including ’Menu link attributes' and 'Menu item attributes'. Follow instructions on screen.
- Go to the module issue queue at http://drupal.org/project/issues/menu_attributes?status=All&categories=All
- Check if your particular issue exists. If not, click on the CREATE A NEW ISSUE link.
- Fill the form.
- To get a status report on your request go to http://drupal.org/project/issues/user
Read more at http://drupal.org/node/250790