Drupal 8 – Vocabularies

drupp

The first step in using taxonomy is to identify and create the vocabularies that you will use to categorize content on your website. Depending on the focus of your site and the breadth of subjects that you cover, you may only need a single vocabulary or you may need several vocabularies. There isn’t a “correct” answer, nor is there a formula that you can use to determine how many vocabularies your site will need. The best approach is to think about the content that you will include and the subjects that the content will cover.

If the subjects are all related (for example, types of sports), then a single vocabulary is likely all that you will need. If the subjects are not related (for example, a book-related website where books may be categorized by author, subject, publisher, and targeted audience), then the use of several vocabularies may be necessary. It’s up to you, the site creator, to define the structure that best suits the purpose of your site, how you want content structured, and how you want visitors to access that content.

Once you’ve identified at least one vocabulary, click the Manage link in the admin menu at the top of any page on your site and then click the Structure link. You’ll see a list of options that includes a link to Taxonomy. Click that to reveal a page that lists all of the vocabularies that have already been defined for your site. By default, Drupal creates a vocabulary called Tags as a default generic “container” for terms.

To add a new vocabulary, click the “Add vocabulary” link at the top of the list, revealing the form. In the Name field, enter “Type of Sport,” and enter a brief description in the Description field. The Description field is an optional field and by default is not displayed on the administrative interface for taxonomy. However, you may want to use this field when rendering lists of content as a description about the content that is contained in the list. In responsive web design, the vocabularies come in pretty handy for displaying structured content.

Once you’ve entered values in both fields, click Save. Drupal then displays the list of terms associated with your vocabulary. Since this is a new vocabulary, the list is empty.The next step is to create a list of terms that are associated with the “Type of Sport” vocabulary. To create terms, click the “Add term” button for the vocabulary that you created. Clicking that link reveals the form.

After entering the term and a description, click Save. Drupal then redisplays the form to enable you to enter another term. To practice, create terms for other sports, such as baseball, football, and soccer. Once you’ve completed the process of entering the terms associated with your vocabulary, click “Type of Sport” in the breadcrumb to return to the Edit Vocabulary page, and then click the List tab at the top of the page to see the complete list of terms for the vocabulary.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s