What you will learn
In this article, you will learn about:
- Using Taxonomy to link descriptive terms to Node Content
- Tag clouds
- Path aliases
What you will do
In this article, you will:
- Create a Taxonomy
- Enable the use of tags with Node Content
- Define a custom URL
- Activate site searching
- Perform a search
One way to find content on a site is by using a search function, but this can be considered as a hit-or-miss approach. Searching for an article on ‘canines’ won’t return an article about dogs, unless it contains the word ‘canines’.
Certainly, navigation provides a way to navigate the site, but unless your site has only a small amount of content, the navigation can only be general in nature. Too much navigation is annoying. There are far too many sites with two or three sets of top navigation, plus left and bottom navigation. It’s just too much to take in and still feel relaxed.
Site maps offer additional navigation assistance, but they’re usually not fun to read, and are more like a Table of Contents, where you have to know what you’re looking for.
So, what’s the answer?—Tags!
A Tag is simply a word or a phrase that is used as a descriptive link to content. In Drupal, a collective set of terms, from which terms or tags are associated with content, is called a Vocabulary. One or more Vocabularies comprise a Taxonomy. This a good place to begin, so let’s create a Vocabulary.
Activity 1: Creating a Taxonomy Vocabulary
In this activity, we will be adding two terms to our Vocabulary. We shall also learn how to assign a Taxonomy to Node Content that has been created.
- We begin in the Content management area of the admin menu. There, you should find the Taxonomy option listed, as shown in the following screenshot. Click on this option.
- The next page gives us a lengthy description of the use of a taxonomy. At the top of the page are two options, List and Add vocabulary. We’ll choose the latter.
- On the Add vocabulary page, we need to provide a Vocabulary name. We can create several vocabularies, each for a different use. For example, with this site, we could have a vocabulary for ‘Music’ and another for ‘Meditation’. For now, we’ll just create one vocabulary, and name it Tags, as suggested below, in the Vocabulary name box.
- In the Description box, we’ll type This vocabulary contains Tag terms.
- In the Help text box, we’ll type Enter one or more descriptive terms separated by commas.
- Next is the [Node] Content types section. This lists the types of Node Content that are currently defined. Each has a checkbox alongside it. Selecting the checkbox indicates that the associated Node Content type can have Tags from this vocabulary assigned to it. Ultimately, it means that if a site visitor searches using a Tag, then this type of Node Content might be offered as a match. We will be selecting all of the checkboxes.
- The Settings section defines how we will use this vocabulary. In this case, we want to use it with tags, so we will select the Tags checkbox.
- The following screenshot shows the completed page. We’ll then click on the Save button.
- At this point, we have a vocabulary, as shown in the screenshot, but it doesn’t contain anything. We need to add something to it, so that we can use it. Let’s click on the add terms link.
- On the Add term page, we’re going to add two terms, one at a time. First we’ll type healing music into the Term name box. We’ll purposely make the terms lower case, as it will look better in the display that we’ll be creating soon.
- We’ll click on the Save button, and then repeat the procedure for another term named meditation.
- The method we used for adding terms is acceptable when creating new terms that have not been applied to anything, yet. If the term does apply to existing Node Content, then a better way to add it is by editing that content. We’ll edit the Page we created, entitled Soul Reading. Now that the site has the Taxonomy module enabled, a new field named Tags appears below Title. We’re going to type soul reading into it. This is an AJAX field. If we start typing a tag that already exists, then it will offer to complete the term.
- Now, we can Save our Node Content, and return to the vocabulary that we created earlier. Click on the List tab at the top of the page. Our terms are listed, as shown in the following screenshot.
Taxonomy isn’t listed in my admin menu
The Taxonomy module is not enabled by default. Check on the Modules page (Admin | Site building | Modules) and make sure that the module is enabled. For the most part, modules can be thought of as options that can be added to your Drupal site, although some of them are considered essential. Some modules come pre-installed with Drupal. Among them, some are automatically activated, and some need to be activated manually. There are many modules that are not included with Drupal, but are available freely from the Drupal web site.
If a new Node Content type is created that will use tags, then edit the vocabulary and select the checkbox.