Community Documentation

Creating a vocabulary

Last updated January 17, 2012. Created by cel4145 on May 23, 2005.
Edited by rwilson0429, drodriques, LeeHunter, nedjo. Log in to edit this page.

When setting up a vocabulary, Drupal will prompt for:

  • Vocabulary name (Required) -- A name for this vocabulary; for example, Topics.
  • Description (Optional) -- A description of the vocabulary (this item may be used by some modules and feeds).
  • Types (Required) -- A vocabulary may be associated with one or more node types. So, an administrator might declare that a particular vocabulary is to be associated with stories and blogs, but not book pages. If an expected node type is unavailable, check and make sure that the module for the specific node type has been activated.
  • Hierarchy (Optional) -- Allows a tree-like taxonomy (In Drupal 5, hierarchies are set as an option. In Drupal 6 and later, all vocabularies are hierarchical if that's how you arrange the items.).
  • Related terms (Optional) -- Allows relationships between terms within this vocabulary. Think of these as "see also" references (this item is not used by many Drupal modules).
  • Freetagging (Optional) -- Users create terms as they go by typing comma-separated lists of the terms they want to apply to content instead of selecting from a pre-existing list of terms. Freetagging vocabularies will present users with a text input that will autocomplete with matching terms if they exist.
  • Multiple select (Optional) -- Allows users to categorize nodes by more than one term. Useful for cross-indexing content. Nodes may then appear on multiple taxonomy pages.
  • Required (Optional) -- Requires a user to select a term in this vocabularly in order to submit the node. Otherwise, when creating a node, users will be offered a none option as the default for each vocabulary.
  • Weight (Optional) -- Allows the administrator to set the priority of this vocabularly when listed with other vocabularies. When vocabularies are left with the default weight of zero, Drupal displays multiple vocabularies in alphabetical order. Increasing a vocabularies weight with respect to other vocabularies will cause it to appear after them in lists. Conversely, lighter vocabularies will float nearer the top of lists. Useful for specifying which vocabulary a user sees first when creating a node.

CREATING VOCABULARIES AND TAXONOMY TERMS THE DRUPAL 7 WAY

In D7, Vocabularies are used to group, organize and, in many cases, categorize a set of taxonomy terms. Vocabularies are fieldable entities and are given a name and vocabulary id (vid) making it referenceable by other Drupal compoents. So, vocabularies can be thought of as parent or root containers for taxonomy terms. Creating a vocabulary can be as simple as assigning the container a name.

To create a vocabulary:

  1. go to admin/structure/taxonomy
  2. click Add Vocabulary
  3. Give your new vocabulary a name (required)
  4. Optionally, give your new vocabulary a description (optional but good to do)
  5. Click Save.

That's it, your vocabulary is created and waiting for you to add some terms to it. Other contributed modules like the Taxonomy Menu module may add additional configurable settings to the admin/structure/taxonomy/add page.

Note that D7 comes with a empty 'Tags' vocabulary already setup for you. The 'Tags' vocabulary is a 'free-tagging' vocabulary that will hold user created terms that are added to the Tags vocabulary when content is created or edited. This is generally accomplished by using a term reference field with an auto-complete widget on the content creation page.

As mentioned earlier, vocabularies are fieldable entities in D7, therefore, you can, optionally, add fields (e.g. an image field, etc) to your vocabulary at admin/structure/taxonomy/[your-vocabulary-name]/fields.

ADDING TERMS TO A VOCABULARY

After setting up your vocabulary, you will need to add taxonomy terms to it in order to organize your content. Terms can be added at any time but, you can't effectively organize your content by taxonomy terms until you add terms to at least one vocabulary.

To add terms to your vocabulary:

  1. go to admin/structure/taxonomy/[your-vocabulary-name]/add
  2. Give your term a name
  3. Optionally, give your new term a description (optional but highly recommended)
  4. Click the 'Relations' colisible field set to open it
  5. Assign a weight to your new term (optional)
  6. Assign parent terms. Select 'root' if you don't want parent terms. Click the 'Add' button or link to assign each parent term or to assign the parent as root.
  7. If you have Path Auto module installed and clean url enabled, you can configure the URL path settings
  8. click save.
  9. repeat steps 2 thru 8 for each term that you want to add to the vocabulary

That's it, you've created your taxonomy term(s) and assigned them to your vocabulary.

Adding terms to your content

To use taxonomy terms to organize your content, you must add the applicable taxonomy term(s) to your content while adding or editing content.

  1. In order to associate taxonomy terms to your content, you must add a field of type 'term reference' on the /admin/structure/types/manage/[your-content-type]/fields page.
  2. Under the 'Field' column, click the select box and choose the type of field widget that you want your users to use to assign the term(s) to the content.
  3. Click Save to save your field changes
  4. After clicking Save, you are immediately taken to the 'Field Settings' page.
  5. Select the Vocabulary that you want to use with this term reference field, then click the Save field Settings button or link.
  6. After clicking the 'Save Field Settings' link, you are taken to a page to configure the newly added term reference field. Here you can change the term label, provide some help text and provide a default value.

That's it, you have associated at least one vocabulary to a content type. You are now able to organize your content using taxonomy terms when content is created or edited. Happy organizing!

Comments

Drupal 6.x update needed

Drupal 6.x has a "Help Text" field, but it has no "Hierarchy" and "Related terms" fields.

Vocabulary in a vocabulary - Drupal Taxonomy

Is it possible to put an existing vocabulary into another vocabulary (D6)?

Lack of context

Again, the same goddam lack of context I denounced on another doc page:
'When setting up a vocabulary, Drupal will prompt for:'
What does that mean ? WHERE or HOW do we get to that page you're talking about ?
A.R.

Drupal 7 missing fields

In my new Drupal 7 installation, I only see Vocabulary name and Description, but not the other options under Structure > Taxonomy > Add Vocabulary.

How do I change these fields?

same issue here

same issue here

Missing fields - creating vocabularies and terms

I have the exact same problem.
I've installed Drupal 7.8.

The first post on this subject was in January 23, 2011.
Today, 9 months later, the problem is the same
- and none of the questions here has been answered.

And when it comes to terms there is a similar situation: “Related terms” and “Synonyms” doesn’t exist. But there is a field for “URL alias” and “Text format”. And “Parents” resides under “Relations”.

I'm totally new to Drupal and it gets really confusing when entering this contradictory introduction to the scene of Drupal and not finding any answers, when, as all other posting here, I really want to get to the bottom with this.

There are no help in the Documentation.
I've spend hours looking for answers on how to get this working whiteout finding anything useful (at Drupal Schools there are a lot of interesting tutorials on a lot of things, but I have not found any that deals whit this subject for D7 – they are all D6 or older).

Why is this problem neglected when getting the taxonomies working is the first vital step when getting to know and creating a Drupal website?
When looking at all the good things about Drupal, all tutorials, guides, and work done all over the planet, I'm surprised that the Drupal community in this matter to this point have not worked better.

Maybe it's time for a change now?
Is there anybody interested in giving some assistance to solve this matter?

EDIT, 2011-10-28.

One good thing though is the Learn Drupal 7 with nodeone, about taxonomy, vocabularies and terms-tutorial. Even if it doesn't explain the issue with the missing fields in this discussion it gives a great first help in actually understanding and using the Drupal taxonomy concept, in the way it actually displays.

Kind Regards
ICIT
Windows 7, x64
WAMP System:
Apache Ver: 2.2.17
PHP Ver: 5.3.4
MySQL Ver: 5.1.53

Why there is no "Freetagging" option in Drupal 7?

Why I can't find the "Freetagging" in Drupal 7? Only name and description can be found in Drupal 7.

Drupal 7.x lacks questions

I am running Drupal 7.0 and am only able to input:

* Name,
* Description,
* URL alias,
* Parent terms, and
* Weight

How do I use / change the other options mentioned in this article, such as Types, Freetagging, Multiple Select, and Required?