In this chapter, we will be looking at organizing the structure of content on your Drupal website. To start with, we'll look at menus before investigating taxonomy in more depth than in our earlier introduction. Finally, we will take a look at creating lists of data as pages and blocks using the Views
module.
The representation of the structure of your site to a user will often be via menus. Here we will show you how to manipulate these menus so that you can help a user navigate your site.
As it stands, our Main navigation menu items are listed in alphabetical order:
However, we would like the items in the following order:
Home | Our Services | Our Clients | About us | News | Contact us
To edit the menu, visit the Menu management at Manage | Structure | Menus:
You will see a list of all the currently defined menus; try editing the Main navigation menu:
Use the 'drag handles' to reorder the menu items:
Rearrange the order and save so that your Main navigation menu appears like this:
Earlier, we made a dedicated Contact us Basic page and we linked it into the Main navigation menu at the same time. To illustrate the idea of editing menu items manually, let's point this menu item to the existing Contact form that was automatically provided to us by the Contact
module instead of the Basic page.
Even though the menu item was created at the time of creating the page, we can easily overwrite the location that it points to. You may remember from Chapter 4, Getting Started with the UI, that the Contact module provides a contact form at http://drupal-8.dd:8083/contact
.
Visit the Menu management page again by navigating to Manage | Structure | Menus | Main navigation.
In order to have the Contact us menu item point to the form instead of the Basic page, all you need to do is manually edit the menu item by clicking on the Edit button in the OPERATIONS column.
The Menu link title is simply the text attached to the menu item (1) but the Link, in our case the Contact us Basic page, is neatly disguised as the title of that targeted page with the nid
in brackets afterward:
Edit the item's Link replacing the existing reference to your Contact page (the Basic page with a node ID of 6) with the replacement path of /contact
, which is provided by the Contact module.
To manually enter a relative path such as this, precede the path with a forward slash (/).
Save your changes.
Since you are no longer linking the Main navigation menu to the Basic page you created in Chapter 4, Getting Started with the UI, we could remove that page but in fact, we'll keep it and use it later to demonstrate some other features.