Taxonomy is not a common word to hear in the English language, so chances are if you haven’t dedicated your life to studying the mating habits of African dung beetles or tinkering with Drupal then you may not have even heard the word before. Taxonomy refers to a system of classification used to group similar items. In Drupal Taxonomy is used to group your pages by the subject matter or by other criteria so that they can later be sorted into page listings (using the Views module) or manipulated in some other fashion.
To find the Taxonomy administration page in Drupal 6 go to the navigation menu and click on “Content Management” then under that click on “Taxonomy”. In Drupal 5 the link for Taxonomy says “Categories” instead (which was confusing for some people). For both Drupal 5 and Drupal 6 you can get to the same page by entering admin/content/taxonomy after the domain name for your site.
In addition to the word “Taxonomy” There are a couple of other terms that need to be differentiated in order to fully understand Drupal Taxonomy.
Vocabulary: Vocabularies in Drupal are like containers, or folders which hold groups of related terms, or groups of terms that you want to use in particular areas of your site. If you have not created a vocabulary already you may have one vocabulary set up already for Forums.
Term: In Drupal terms are words that can be attached to pages by users or administrators. One thing that is important to understand about terms is that they can be changed as much as you want, but unless they are deleted they will retain connections to the pages they were attached to. So for instance if you create a term called “fat” and then change it to “skinny” later then all the pages that you labeled fat will now be labeled skinny. This is due to the fact that terms in Drupal are actually stored as numbers in the database. Those numbers are associated with the words that you create and edit, but since it is the numbers that are actually attached to the pages you can reorder and change your taxonomy to your heart’s content without worrying about breaking it.
Adding a Vocabulary to your Drupal Site
To get started if you don’t have any vocabularies yet, or if you only have a vocabulary for Forums go ahead and create a vocabulary by clicking the tab at the top of the taxonomy page that says “Add Vocabulary”. Give the vocabulary a name, “Department” could be a good one to use if your site was for a university for example. You can add a description if you want to; it isn’t necessary, but if you have others using the site it might be helpful. Help text is the text that will be shown to the user to help them chose a term; also not necessary but helpful. Then there is the content types section. The content types are the types of pages where you want this new classification system to appear. For some situations you may only want a vocabulary to appear on blog pages for example. Finally there are a set of options which determine how your new vocabulary will be displayed on the node edit pages.
The “Tags” checkbox determines if your users will be allowed to free tag pages by entering any text that they want to. This can be easier to set up in the beginning, but the tags can become quite messy if you are not careful. The “Multiple select” checkbox is where you determine if users can pick more than one term from this vocabulary on a page. Often this is useful in situations where categories are not limiting such as an article that is about science teachers which you may want to label the article under “science” and also under “education”. Other situations are not as flexible such is in a vocabulary that determines the difficulty level of a ski slope. You wouldn’t want the user to have the ability to label it as both “Extremely Dangerous” and “Kiddie Slope”. That could lead to confusion. It is your site, so you have to decide how you want to set it up (unless you decide to pay someone to do it for you). The “Required” checkbox is self explanatory, but my advice is not to use it unless you have a good reason and you know what you are trying to accomplish. Otherwise people may get frustrated due to the fact that the page will not allow them to submit until they choose a term from this vocabulary. If your site really depends on this kind of categorization then it may be necessary.
The “Weight” dropdown is really pretty pointless in Drupal 6 since the new Taxonomy system allows you to reposition term and vocabularies by dragging and dropping.
Once you are done click save and now you should see the vocabulary you just created listed in the vocabulary list.
Adding Terms to your Vocabulary
To add terms to your new vocabulary click the link to the right of the vocabulary name that says “add terms”. Don’t click “edit vocabulary”, it won’t hurt anything, but it take you right back to the page you just came from and you don’t need that.
Once you click on the “add terms” page all you need to add is the term that you want to add. You can add a description if you want, but it isn’t necessary, and in many circumstances it really isn’t worth the time. Click “save” and it will take you automatically back to the page to create a new term. This saves time when you are adding many terms.
To view the terms that you have added just click the link that says “list” on the top of the page. There you should see your new term.
Another thing that is worth noting in Drupal is that terms are hierarchical. This means that you can create a term called Education, then underneath that put a term called Mathematics and under that term create a term called Trigonometry. In the scheme I just described Education would be the top parent term, Mathematics is its child and Trigonometry is the child of Mathematics.
If you did everything right when you go to add a page for any of the content types that you have enabled for your new vocabulary you should see a drop down box with those terms that you have added.
One last note regarding multiple select… multiple select on taxonomy terms works just the same as when you select multiple files on your computer. If you want to add multiple terms one at a time then just hold down the control button as you click each item (command on mac).