Beginners Guide to Drupal: Menus
Menus allow visitors to easily navigate through your website. These menus list links to important pages on your website and let visitors easily access content. Menus is the best option to organize your pages in an easy-to-use manner.
The new Drupal 7 comes with four menus – Main Menu, Management, Navigation and User Menu.
The Main Menu is the primary navigational menu used for the main section of the site. It lists the hierarchy that all the site pages should fall within. This is the menu to which content items are added from the menu options under content editing.
The Management menu lists the links for the administrative tasks (Content, Structure, etc.).
The Navigation menu provides a menu of quick links that is exposed to site visitors.
The User menu contains the logout link and links for an individual user to manage his/her account.
Creating a new menu
To add a new menu follows the following steps:
- Go to the Structure > Menus as an administrator. You'll end up at the menus page where you can see the four default menus of Drupal and an “Add menu” link at the top.
- Click the “Add menu” link. (see Figure 7: Menus)
Figure 7: Menus
In the Add menu page, there are two fields: title and description. The title is visible to site visitors: it can be anything you want. The machine name beside the title field will automatically generate depending on the title. A description for the menu can be useful to describe what the menu is for. Once you have filled up both fields, click the save button. (see Figure 8: Add menu)
Figure 8: Add menu
Adding menu link/item
You can set internal or external paths for new menu items. If you want to link an internal page to the new menu item, this page needs to be created before adding a new menu link. To add a new menu link, follow the following steps:
- Add a new content/page by following the instructions in the previous post (http://grype.ca/blog/beginners-guide-drupal-content-and-content-types)
- Click on the list links on the menu. You can add links from the Structure > Menus page. (If you created an entirely new menu per the above “Creating a new menu”, the menu page will show that new menu, e.g. 'My Menu') (see Figure 9: Menus)
- Click on the Add Link button at the top of the menu list links page (see Figure 10: Menu link)
Figure 9: Menus
Figure 10: Menu link
There are several fields in the Add link page. The Menu link title field is the name of the menu link. The path is where the menu entry will take your visitor. This can be an external link such as https://www.drupal.org, or an internal link such as node/1 or admin/reports. The description can be useful to know what the menu entry is for. The Enabled checkbox allows you to make the menu entry active or inactive without having to delete it. If this menu link has sub-menus, known as children, the Show as expanded checkbox allows the menu item to stay expanded so that the children are shown by default. The Parent link dropdown allows you to choose where in the menu hierarchy your menu item belongs. Weight defines the relative rank of your menu entry: a smaller number means it is placed higher up. After entering all the fields, click the Save button to save the changes you have made. (see Figure 11: Add link)
Figure 11: Add link