Drupal - Main Menu
Drupal - Managing Menus and Menu Links
Section titled “Drupal - Managing Menus and Menu Links”Menus are essential for website navigation, providing users with organized links to different sections and pages. Drupal offers a flexible system for creating and managing multiple menus and their links.
Part 1: Creating a New Menu
Step 1 − Navigate to the Menus page. In the administration toolbar, click ‘Structure’, then ‘Menus’.
This page lists all existing menus (e.g., ‘Main navigation’, ‘User account menu’).
Step 2 − Click ‘Add menu’.
Step 3 − Define the new menu. You’ll need to fill in:
- Title − The human-readable name for your menu (e.g., ‘Footer Links’, ‘Secondary Navigation’). This is how you’ll identify it in the admin interface.
- Administrative summary − An optional description for administrators, explaining the purpose or placement of this menu.
Click ‘Save’. Your new, empty menu is now created.
Part 2: Adding Links to a Menu
Step 4 − After saving the new menu, you’ll usually be taken to its editing page. If not, find your new menu in the list on the ‘Structure’ > ‘Menus’ page and click ‘Edit menu’ or ‘Add link’ next to it. To add the first link, click the ‘Add link’ button.
Step 5 − Configure the menu link details:
- Menu link title − The text that will be displayed for this link in the menu (e.g., ‘About Us’, ‘Contact Support’).
- Link − The destination URL. For internal Drupal content, use its path (e.g.,
/about-us,/node/7). For the homepage, use<front>. For external sites, use the full URL (e.g.,https://www.example.com). For a non-clickable parent item, use<nolink>. - Description − Text that often appears as a ‘title’ attribute on hover, providing more information about the link.
- Enabled − Check this box to make the link visible in the menu. Uncheck to hide it without deleting.
- Show as expanded − If this menu link has child items (sub-menu), checking this box will make the children visible by default (behavior can depend on your site’s theme).
- Parent link − Choose an existing link in this menu to be the parent of this new link, creating a hierarchical (dropdown) menu. Leave as the menu’s root to make it a top-level item.
- Weight − A number that controls the order of links at the same level. Lower numbers appear before higher numbers (e.g., -10 before 0, 0 before 10).
Click ‘Save’ to add the link to your menu. Repeat Step 4 and 5 to add more links.
Step 6 − (Crucial for visibility) Placing the Menu on Your Site: Creating a menu doesn’t automatically display it. You need to place it as a Block. Navigate to ‘Structure’ > ‘Block layout’. Find a suitable region in your theme (e.g., ‘Header’, ‘Sidebar’, ‘Footer’) and click ‘Place block’. In the modal, find your menu (it will be listed by its title) and click ‘Place block’ next to it. Configure the block settings (e.g., visibility per page) and save.
Real-world application: The ‘Main navigation’ menu typically holds links to the most important sections of your site. A ‘Footer Links’ menu might contain ‘Privacy Policy’, ‘Terms of Service’, and ‘Sitemap’.
Extra Tip: You can also add content to a menu directly from the content editing page via the ‘Menu settings’ tab, as described in the ‘Creating Content Pages’ chapter.