Terms, Vocabularies, and Categories: "Tagging" Your Content
Words about words
Tags are power
Drupal offers a very flexible system for "tagging" your content – that is, attaching keywords to it for use in organization or searching. Why do that? As software developers and webmasters everywhere have discovered, tagging content makes it so much easier for software to know what content is about. With tags on content, a program can instantly pick out, for example, all news articles that are about politics, or all product catalog listings that are cooking-related and are books (i.e., not just any cooking tools or any books, but only cookbooks). The same goes for tagged content on your site.
It's a very powerful tool that makes many things possible – so powerful and flexible, in fact, that the possibilities are overwhelming at first. This page will outline basic ways you can make use of tagging to organize your site content.
A word about words about words
First, a word about terminology. Let's revisit the discussion of "category" from Important Terminology!:
Drupal lets you assign keywords, or "Terms", to your nodes. The language it uses to discuss this, however, is frankly confusing. Here's your guide:
- Term: A Term is a keyword or tag that you associate with a node. Useful Terms include words like 'news', 'product', 'pets', anything you can think of that classifies your content. With Terms that classify your content, you can easily organize it. For example, you can create a menu item called 'News from the Pet World', which is set up to display any nodes that have the Terms 'news' and 'pets' attached – i.e., the articles you've written about news concerning pets.
- Vocabulary: A Vocabulary is a number of Terms grouped together for convenience. For example, you might have a Vocabulary called 'Product Type', containing Terms like 'sweater', 'jacket', 'socks', etc., for use with any node that describes a product.
- Taxonomy: A somewhat vague word to indicate the overall way Terms are used to classify and organize nodes in your site. You likely won't need to worry about this word; if you see it in some document discussing Drupal, just know that the topic concerns Terms and Vocabularies.
- Category: A confusing word: some Drupal documents say it means the same thing as Taxonomy, others seem to equate it with Vocabulary. I'll try to avoid using it, and stick to discussing the words that Drupal is clear on: the "Terms" that act as tags for your nodes, and the "Vocabularies" that are groups of Terms. (But just to keep things complicated: to set and edit your Terms and Vocabularies, you need to visit a form titled "Categories".)
That passage provides more examples that clarify what we'll discuss on this page, and it sets up terminology we'll use too. A short review that puts those words into their places:
We're going to discuss taxonomy, the use of "keywords" or "tags" to classify and organize your content. Instead of those popular words, though, Drupal calls keywords or tags Terms. It calls a group of related Terms a Vocabulary. So we'll talk mostly about Terms and Vocabularies, but we'll avoid the superfluous word category, other than to note that we need to visit a form called "Categories" to manage our Terms and Vocabularies.
Got that? Good!
Ready-made tags: node types
Let's note from the start that all your content already has a built-in tag: its node type – Page, Story, Blog entry, etc. (I'm calling this "tag", not "Term", because Drupal doesn't technically treat node type as a Term.)
So even if you stop reading here and create or use no Terms, you're already classifying content in at least one way, and can organize it based on node type. For many sites, that simple organizational ability will be enough. Just use Blog entries for, say, news; Stories for product info; Pages for company info; etc. Set a 'news' menu item to call up all Blog entries, a 'products' menu item to call up all Stories, and so on. There you go: simple organization for a simple site. See Linking to Content for more.
A site of even moderate size or complexity, though, will quickly outgrow that scheme. If you'd like to explore a deeper way to organize content, read on.
Setting the Terms
Here's where to find our form for playing with Terms:
Navigation » Administer » Content management » Categories
The 'List' tab
The list you see under this tab is a list of Vocabularies. The three columns in the list:
Name
The name of the Vocabulary.
Type
This isn't a "type" of Vocabulary itself. Rather, this displays the node types that can use the Vocabulary. For example, if a Vocabulary which you named 'topic' happens to list "Page, Story" under 'type', that means only Pages and Stories can be tagged with Terms from the Vocabulary named 'topic'; Blog entries can not use those Terms.
Operations
Things you can do with the listed Vocabulary. See details below.
The 'Add vocabulary' tab
Before you can create and use Terms, you need to create one or more Vocabularies to hold them. If that's not already done for you, read on. Here's what you see on the 'Add vocabulary' form:
Vocabulary name:
The name of the Vocabulary. It will appear on the list of Vocabularies, and on the forms for creating content that uses the Vocabulary.
Description, Help text:
Optional extra information. Feel free to ignore these.
Types:
As discussed above: what node types can use this Vocabulary? Check those that apply.
For example, if you are creating a Vocabulary called 'Product Category', and know that you only want to use its Terms with Pages (the node type you plan to use for your product info listings), you should check only 'Page'.
If unsure, check everything! If you're the only one entering content, there should be no harm. But if you're allowing others to create content on your site, put a little thought into it. For example, you may be allowing others to post Blog entries on your site. Do you want to allow them to tag their entries with Terms from your 'Product Category' Vocabulary, or not? This is the time to decide.
Hierarchy:
There are a lot of choices under this heading (not all of which are really connected to hierarchy).
Disabled, Single, or Multiple: Just as menu items can have "child" sub-menus, your Terms can have "child" sub-Terms below them.
If you select 'Disabled', that won't be the case for this Vocabulary; it will have one "flat" level of Terms beneath it.
If you select 'Single', you can have child Terms, even in multiple layers. For example, your 'Product Category' Vocabulary may have the Terms 'tools' and 'machinery' – and under 'machinery', more specific child Terms like 'pump', 'generator', and 'purifier'.
More layers are possible. Your child Term 'purifier' might have 'filtration', 'reverse osmosis', and other purifer types below it, as "grandchild" Terms.
If you select 'Multiple', a child Term can appear under more than one parent Terms. For example, you could have the Term 'lathe' appear as a child under 'tools', and appear as a child under 'machinery'. Just select as many parents as you like when creating the Term (for the second and later Terms, use your computer's "mutiple select" key: Command for Macs, Ctrl for Windows machines).
With multiple parent Terms selected, the new child Term will appear separately under each parent. It's still a single "instance" of the Term, though; if you pick one of the Term's appearances for modification or deletion, you'll modify or delete all its appearances in that Vocabulary.
What's the point of these hierarchies? In addition to general orderliness in your Vocabulary, you can make use of useful techniques, such as a single link that returns all content tagged with the parent Term and its child Terms. For example, you can create a link returning content tagged with 'machinery', or any of 'pump', 'generator', and the other child Terms below it. That link will catch any nodes dealing with machinery products, even a node only has the Term 'pump' and not 'machinery'. See Creating Links.
Related items: The usefulness of this is unclear. Look forward to an explanation later.
Free tagging: An interesting option that lets you create a Term on the fly, typing it in when you create content. This may be useful when creating a list of Terms in advance would be a nuisance.
One example: You're creating a site that posts celebrity gossip. You'd like to tag each node with the discussed celebrities' names, but there are far too many to include in a list (and they keep breeding, too). On-the-fly Terms may be the perfect solution.
Multiple select: Another useful option. A node can always take a Term from each of several available Vocabularies, but checking this option allows a node to use multiple Terms from the same Vocabulary. For example, a product listing for a machine repair manual could be tagged with 'machinery' and 'books', two Terms from the same Vocabulary. The result: a page that listed products tagged with 'machinery', and a page that listed products tagged with 'books', would each display this product.
Note: When creating a node with multiple Terms from a Vocabulary, clicking the second Term will only un-click the first. You need to hold down your computer's "mutiple select" key (Command for Macs, Ctrl for Windows machines).
Required: When creating a node, you normally are free to choose no Term from a given Vocabulary. But not if this setting is checked! You won't be able to submit the node without a selected Term. This is a useful setting when you are allowing others to submit content, and want to enforce tagging.
Weight:
This will determine the placement of the Vocabulary on the list of Vocabularies – an item of very little importance. Feel free to ignore it.
Teaser, Meta tags:
Fields for these may appear, but they are not important for this form. Ignore for now.
Editing a Vocabulary
Clicking 'edit vocabulary' on the list of Vocabularies takes you to this form. It's the same as the form for adding a Vocabulary; see full procedures above.
Listing terms
At long last, we get to the meat of your Vocabularies. Clicking 'list terms' on the list of Vocabularies shows you two things: a list of the included Terms, and a link to add more Terms (see below).
The list of Terms has two columns: 'Names' and 'Operations'. The latter only holds a link to edit the Term. The former is more useful than it first looks: the name is also a link that calls up all content tagged with that Term. This will come in handy when making menu items and other links that call up content based on Terms. See Content Paths and URLs and Linking to Content.
Adding terms
The final item to cover, and an important one. This is the tool to create new Terms.
Clicking 'add terms' switches to an 'Add term' tab. Here's what it offers:
Parents:
If you have a "hierarchy" of Terms (see Disabled, Single, or Multiple: above), you'll have the option to pick a "parent" Term (assuming there's already at least one Term in the Vocabulary). Pick '<root>' to place the Term at the "top level", with no parent Term. Or pick an existing Term to place your new Term under it as a child Term.
Term name:
The name of the Term: 'products', 'news', 'general info', 'France', whatever you want.
Description:
Type in some info on the Term, or its intended use, if you wish. It's generally not important.
Synonyms:
The usefulness of this field isn't yet clear. Ignore.
Weight:
If it matters to you, you can use "weight" to set the Term's location inside the Vocabulary. A "light" (negative) weight will place it higher on the list; a "heavy" (positive) weight will place it lower. Many admins won't consider this important.
Teaser, Meta tags:
Fields for these may appear, but they are not important for this form. Ignore.
Tagging content
Now that you've got Terms, what to do with them? Simple: when you create content, you'll see Terms listed under 'Categories' on the node's edit form. From the list(s), pick whatever tags you want to attach to that node. This is briefly described under the heading Categories on Create a Page Node.
As described earlier, you can set which node types can use which Vocabularies. When creating a node, each available Vocabulary will appear as a separate list. You can choose a Term from each Vocabulary list – or even multiple Terms from any Vocabulary which has "multiple select" enabled (see above).
Once content is tagged, you'll be able to perform tricks with those Terms. See Content Paths and URLs and Linking to Content.













Re: Terms, Vocabularies, and Categories: "Tagging" Your Content
I have hated taxonomy, node, vocabulary for aslong as ive known about it.. always ended up deleting drupal and trying other CMs's .. this has got to be my 10th time ive uploaded drupal and given it another go.. After finding and reading this i finally understand what taxonomy and vocabulary is all about..
Halilulliah praise the lord !
- merci :D
Re: Terms, Vocabularies, and Categories: "Tagging" Your Content
Thank you! Glad it helps. I think everyone gets confused at first, as too many different words are being used in too many places. That's unavoidable with a big open-source project like Drupal – but the great part is that over time, good, battle-tested terminology will float to the top.
As for actually using taxonomy in Drupal, I believe it's like the game go: really very simple to learn, but deep to master!
Post new comment