Documentation Level: 
Documentation Status: 
No known problems

The meaning of Taxonomy

The general meaning of Taxonomy is the science of classification. In Backdrop it refers to the method by which your website content is organized, using different words or phrases to label the content. In Backdrop the Taxonomy module enables this ability to classify your site content.

For example, when creating or editing Post type content, there is by default a textfield called "Tags" which allows you to add a category to your post. So for example, if you are writing a series of stories about dragons, you may decide to type "firebreathing" into that field whenever the dragon you are writing about is of the fire-breathing variety; Other posts may need the tag "wingless" if the dragon being documented here is of the rare wingless variety. If by chance the currently described dragon is both wingless and fire breathing, you may type both terms into the Tags field to label that post as such.

Once published, the post will have a visible label on your site stating the tag or tags which have been applied. Furthermore, visiting the path 'tags/firebreathing' will reveal a list of all content on the site which has been tagged 'firebreathing.'

The "Tags" field is a field provided by the Taxonomy module which allows you to "tag" (label) content with "terms" (labels) which are part of the "Tags" vocabulary (group of related labels).

So to summarize the expressions used to describe Backdrop Taxonomy, consider the following meanings:

  • Term - The word or phrase that is used to describe or label content. In some articles, it is referred to as descriptor. Example "firebreathing."
  • Vocabulary - The vocabulary is a list of multiple terms related in some way. Example "Dragon color" may be a vocabulary containing the terms black, red and silver (see Taxonomy and fields below).

And more generally:

  • Taxonomy - The categorization of the content in a hierarchical structure.
  • Tagging - The process that associates a term with the content on your Backdrop website.


Taxonomy and fields

Terms are added to nodes and other entities using term reference fields. The settings for term reference fields include an option to set which vocabulary should be used. There is also a special widget called the autocomplete term widget (tagging). This widget makes Backdrop display suggestions matching what the user types. It also allows the user to add new terms if the typed text doesn't match any existing term in the relevant vocabulary.

Continuing with the example in the introduction, you could have needed another category called "Dragon color" with a limited set of allowed colors (say only black, red and silver). You could then create a new Dragon color vocabulary with only those three terms (black, red and silver). You could then link this new vocabulary to Post nodes by adding a term reference field, choosing a select list instead of a textfield (see documentation on how to add fields to node types). So when creating the Posts, you can tag by random characteristic using the "Tags" field, or tag by color using the "Dragon color" field. 

Creating and managing vocabularies and terms

Under the toolbar option Structure, Taxonomy is a list of all the vocabularies on your website. In a standard Backdrop installation, you will only see tags. Each vocabulary is presented along with some management links for editing the vocabulary settings, listing existing terms, and adding new terms.

The list of taxonomy terms allows you as administrator to reorder the terms, which includes creating tree structures. It is also possible to edit each term The form for adding or editing terms holds information about the term name, any URL alias for the term, and also a term description. The term description is actually an entity field, and it is possible to add more fields to terms. The edit page also allows you to set any parent terms, but this is easier to manage in the drag-and-drop list of terms.

TIP: It is possible to select more than one parent term on the term edit page. This allows for interesting relations between terms, but makes it impossible to use the click-and-drag list for managing the list of terms. If you set more than one parent term, the click-and-drag list is disabled.

Above the list of vocabularies, you will find a link Add vocabulary, leading to a form used for (you guessed it) adding new vocabularies. Each vocabulary has a name and, optionally, a description. Backdrop will automatically suggest a machine name for the vocabulary, based on its plain-text name.


Fields on taxonomy terms

Just as with node types, comments and user accounts, you can add entity fields to taxonomy terms. The fields are set on a per-vocabulary basis, and the field settings are available from the edit page for the vocabulary and the tab manage fields.


Elaboration: taxonomy terms, text fields or nodes?

In basically all medium-complex Backdrop sites you will face one or two decisions relating to taxonomy:

Should a particular field (for example section) be a text list field, or should I use taxonomy terms? Both could give me a selection list for sections when creating content.

Should a certain type of data (such as product types) be a node type, or should they be taxonomy terms? Both are fieldable and may contain whatever information I need.

Deciding these questions usually requires knowledge of the website and its data, and experience of managing data with Backdrop. Sometimes it has little or no consequence what you choose, but an incorrect choice could lead to a lot of extra work later on.

Here are some tips for approaching these kinds of decisions.

  • What is good or bad is, at the end of the day, determined by what works and what doesn't work.
  • That taxonomy terms give you automated lists of content is not a reason to choose terms over text fields or nodes. The Views module allows you to build similar lists based on text fields or other data. (See Chapters 8-10 for more information about Views.)
  • When deciding between text fields and taxonomy terms, determine if the information is a necessary part of the node/entity. If so, text fields are usually the better choice. If you're dealing with meta information, on the other hand, taxonomy terms are usually the better choice.
  • When deciding between text fields and taxonomy terms, be aware that taxonomy terms may be edited and even deleted independently of the node/entity. The term information is separate from the node/entity.
  • When deciding between node types and taxonomy determine if you need any of the functionality available only to nodes, such as publish states, revisioning, access control, authors, and so on.
  • When deciding between node types and taxonomy terms – will the data only be used to describe other content on the site? If so, taxonomy terms could be the better choice. If it makes sense to look at the data in itself, nodes are probably better.