Using taxonomy to organize content

Drupal Taxonomy: the power to organize and reorganize

Adapted from benc's http://digitalsolutions.ph/couchkamotereviews/power_drupal_categories with permission.

The Drupal Taxonomy module (and the contributed module Categories) is one of its most powerful features. Combined with its hooks, Drupal allows administrators to organize and reorganize content easily, giving more flexibility for knowledge sharing in an organization that continuously discovers better ways to share knowledge.

This tutorial has two purposes:

  • In particular: To show content managers and web developers how web content can be organized and reorganized by using Drupal's taxonomy module.
  • In general: To show the power of Drupal for rapid organization and reorganization and dynamic taxonomy management; these are qualities that make Drupal a good tool to facilitate knowledge sharing.

System requirements: You need an installation of Drupal 4.7 with admin permissions.

Basic terminology:

  • Taxonomy: The name of Drupal's core (included) module for classification.
  • Category: The label used in the Administer area for configuring taxonomy. Also, the name of a contributed (add-on) module for classification.
  • Vocabulary: A group of taxonomy terms.
  • Term: A label (of a taxonomy vocabulary) that can be applied to an item.
  • Labels, Tags: other words that are sometimes loosely applied to mean the same thing as "Term."

Scenario: Starting a news web site

You have been asked to create a web site for a news company. They want to organize web content according to the topic of the story. The topics are Politics, Technology, Business, and Lifestyle. Stories may be about just one topic, or they may be about more than one. For instance, a story may be about both technology and business.

Step 1: Plan your content structure.

How will you organize content in the web site? In our scenario, our client wants to categorize stories as Politics, Technology, Business, and Lifestyle.

Step 2: Create a vocabulary.

After logging in to Drupal, go to (administer > categories) and click the "add vocabulary" tab. In the add vocabulary screen, type "Topic" as the Vocabulary name.

Next, you need to tell Drupal that the vocabulary "Topic" will be used by the Story content type. To do this, check the story checkbox under Type. This step is called binding a vocabulary to a content type.

Next, click the checkbox called Multiple select. This allows selecting more than one taxonomy term for each story.

At this point, you will see many other options. Ignore them for now and play around with them later.

Step 3: Add terms under your vocabulary.

We now need to tell Drupal what labels are available under the Topic vocabulary. To the right of the categories screen, click add terms. In the screen that follows, type a Term name (e.g.: Politics) and click submit. Repeat this for each of the terms under Topic.

You can now review your vocabulary. To the right of your Topic, click list terms. You will see something like this:

Topic
--Business
--Lifestyle
--Politics
--Technology

This gives you an idea of the content structure so far.

Step 4: Now try it out by creating a story.

In the administer menu, click create content > story. Now you see the newly created Topic tags near the top of the form. Type a Title, choose Technology as the Topic, and write some text in the Body field. Click Submit.

You have just uploaded content (a story) and tagged it as Technology.

Upload three other stories and multi-tag them according to the plan below. (To multi-tag, just Ctrl-Click one item after another.)
1 story - Business, Technology
1 story - Lifestyle, Technology, Politics
1 story - Business, Politics

Now you're seeing a bit of the power of Drupal.

Step 5: Exploit Drupal's linking system.

Now you'll get more glimpses of Drupal's power. Go back to the categories screen (administer > categories) and click list terms for Topic. Each of your terms is still listed and are actually links, too. Mouse over "Business" and look at the status bar of your browser; it'll show something like www.example.com/taxonomy/term/555. (Note that the number 555 will be different in your case.)

The link above tells you that "Business" is term number 555. And, get this, you can show all stories that have been tagged as Business by just invoking the link www.example.com/taxonomy/term/555 (using "taxonomy/term/555" will give the same results). Go ahead, try it on your browser. Type that link or just click on "Business" to see the stories that were tagged under Business.

What does this mean? First, without having to reprogram, you can create different ways of displaying content by invoking the taxonomy term numbers. You can create a directory page for your website, similar to Yahoo, simply by creating a story, typing the topics and linking them to the term number. You can even create custom menus using this technique.

You have seen how organizing content is easy in Drupal through its taxonomy module. You also saw that multi-tagging is easy to do in Drupal. Finally, you got a taste of Drupal's power by exploiting term numbers. That's the end of this scenario of our tutorial.

Meanwhile, you can play around with the taxonomy module further. Try out the other options and test the results by creating different stories. When you are ready, go to Scenario 2 (coming soon), which will teach you to harness more power from vocabularies.

References to other beginning-level taxonomy pages (in order):

 
 

Drupal is a registered trademark of Dries Buytaert.