Chapter 6. Structure

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.

Managing menus

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.

Reorganizing menu items

As it stands, our Main navigation menu items are listed in alphabetical order:

Reorganizing menu items

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:

Reorganizing menu items

You will see a list of all the currently defined menus; try editing the Main navigation menu:

Reorganizing menu items

Use the 'drag handles' to reorder the menu items:

Reorganizing menu items

Rearrange the order and save so that your Main navigation menu appears like this:

Reorganizing menu items

Editing menu items

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.

Editing menu items

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:

Editing menu items

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.

Editing menu items

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset