Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In the video about creating and managing content types, we talked a little about the differences in Drupal Gardens between, say, a news item and a blog entry. In this video, you'll learn how to give nodes a different kind of identity through what's called tags. You could say that a content type defines a node's format--that is, it says if the node has certain fields, and they are displayed in this way, and so on. But tags define a node's content. The best way to explain it is with an example. For our site, we're listing different California tours using the tour content type we defined earlier, which has the length of the tour and the price and the picture of the tour.
But let's say that we want to group those tours by theme so that people who like to backpack can find all the walking tours. That's what tags are good for. To get started, I first have to decide what my categories are going to be. For that, we create something called a vocabulary that describes what we're categorizing. Then we'll fill it with our options, which are called terms, and you can see this by going up to Structure, scroll down to Taxonomy. Drupal Gardens comes with two vocabularies already in place: Tags is a general vocabulary that's used throughout the site, and Forums which Drupal Gardens uses internally to set up discussion boards. And you'll find out more about that in the video about starting discussion forums.
We're going to add a different vocabulary, which will be called Type of tour. We could add a description if we like, but I'm just going to leave it alone and click Save. Our next step is to add terms to that vocabulary. Don't worry if this is a bit confusing right now; it will be clearer when we actually go and create some tour nodes and start adding those terms to the tour nodes. But first, let's go ahead and add those terms by going over here and clicking add terms. The first one will be called Backpack California.
I won't put in the description; I'll just go down to the bottom and save. We then come back to the Add Term screen because usually when you create terms, you create many of them all at one go. The next one we'll be called Nature watch, scroll down and save it again, and finally California hotsprings, scroll down and save it. In order to use these tags in a content type, we have to go back and edit the content type. Now remember, we're going to use these on our tour content type, so we go up to Structure and Content types, then down to Tour and manage fields.
As you remember, we added a few fields earlier, and that's exactly what we're going to do now. We'll call it tour type, tour_type, like so, and then under field type, there is actually one specifically for taxonomy terms called Term reference, and then we have a few options as to how we're going to select those terms. I'm going to leave it as Select list, although if you set up your own terms, you'll probably want to play around with these and decide which one is best for you. Also, you'll learn more about these types by watching my video "Drupal Essential Training," where I go into it in a little bit more detail.
Scroll down and click Save. The next question is which vocabulary is going to be the one from which these terms are selected? Of course, since we're going for Tour types, we'll select the Type of tour, and save field settings. On this page, I'll actually just leave everything in its default value, and save settings. Finally, I'll move this up so it's near the length and price, just because it's more convenient on the node form. Scroll down and click Save. Great! Now, we can start to categorize our tours. But you might remember, if we go to content, we only have one tour in already. That's the Big Sur Retreat.
So I'm going to add a couple more. If you're a lynda.com premium subscriber or got this course on a disc, you have the exercise files, which include one file called other-tours. I'm going to use that to copy and paste into my Tour content type. Go down to body and paste. Then our title, let's say that that's a two-day trek. Let's say that the price is 250, and the tour type is Backpack California.
Scroll down and save it, and I'll leave the photo blank; it'll give us that default photo. And then I'll create one more under Tour. Once again, I'll pick that from our exercise file, Channel Islands Excursion. This one is 1 day at $150, and it's considered a Nature watch, and save. Great! Now if we go back to our content list, we see that we now have three tour types.
I'm going to just go back and change that Big Sur Retreat so that we add some type of Tour type to that one. I'll call it Backpack California and save it. Great! Now let's take a look at any one of those-- let's say the Big Sur Retreat. As we scroll down, we see our tour type right here, that Backpack California that we used tag it. When we click on that, we'll see a page that chose all of the Backpack California tours. Furthermore, the URL that goes to that page is stable and simple, so you can create a menu item, and you'll learn how to do that in the video about understanding menus.
In short, tagging content makes it easy for visitors to just click around to see content that most interests them. Tags become even more useful as your site grows into hundreds or even thousands of nodes, and you have dozens of tags. Now tagging does take a little time to set up and a bit more time whenever you create a node, but for making your site a lot more user friendly, it's really worth it.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 66171 Viewers
61 Video lessons · 96710 Viewers
56 Video lessons · 110427 Viewers
82 Video lessons · 105148 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.