1.5. Taxonomy - Taxonomy, vocabularies and terms
In the last lesson we made a blog from Drupal, but that blog didn’t have enough of a tags for articles and tags. Let's add a vocabulary, using taxonomy. Enable the Taxonomy module for this if it is not already enabled.
Taxonomy in Drupal is a method of classification (rubricator, categorization) of nodes with the help of taxonomy tags (terms, categories). Let's create a vocabulary tags, with which we will classify our articles Menu - Structure — Taxonomy.
Let's call the vocabulary tags. After creating the vocabulary, we get to its page, here you can manually create tags (terms), but we will not do this, because tags will automatically be created when we add them to the articles. Note that in Drupal, the elements of the taxonomy vocabulary are called terms. That is, if you have a vocabulary of Tags, Classes, Categories, Sections, then the vocabulary will still have terms.
Now you need to add a tag selection field for articles, for this you need to enable the Field UI module (if it is not enabled). Go to the page for managing the fields of the content types Articles, Menu - Structure — Content types — Articles
Add a new field Tags, field type Taxonomy term:
The number of terms is set unlimited:
Then everything just save. Now let's go to the article creation page, at the moment the terms are selected only from those in the Tags vocabulary, we need another widget with autocompletion of tags and automatic addition to the vocabulary. Go to Menu - Structure — Content types- Articles, but now in the tab Manage from display. Select here for the field Auto-complete input tags:
We save and go to the creation of the article. Now we write tags separated by commas, and Drupal himself add them to the Tags vocabulary.
Now if you go to Menu - Structure - Taxonomy - Vocabulary Tags, then you will see new terms of taxonomy. Each taxonomy term has its own page, to which teaser list all nodes to which this term is attached. The URL of such pages is of the form taxonomy / term / number node, for example taxonomy / term / 2.
The tags themselves are displayed on the full page of the node:
We will more than once deal with taxonomy, so you can safely move on to the next lesson, even if not everything is clear with taxonomy.