Manage your articles using Taxonomy in Drupal 8
Blog

Manage your articles using Taxonomy in Drupal 8

Taxonomy is one of the features that add lot of advantage to Drupal compared to many other CMSs open source as well as proprietary.

Taxonomy is all about organizing your site by assigning descriptive terms to each piece of content.

While you can organize your content based on content types and creators, you might also want to view content based on what the content is about. Taxonomy allows you to associate terms with your content, which you can use to organize and display content on your site. Each set of taxonomy terms is part of a category set that you define, and is called a vocabulary. Terms in vocabularies that can be further broken down and can contain sub-terms.

In this session we would learn

  1. How to create vocabulary
  2. How to add term to those vocabulary
  3. How to add terms to content type


1. How to create vocabulary
Go to Manage >> Structure >> taxonomy, here by default we have Tags vocabulary.
at this place we can add vocabulary by clicking on +Add Vocabulary

 

Add Vocabulary

Please provide Vocabulary name and short description for new vocabulary and click on Save button.

 

Add Vocab Geners of Books

 

2. How to add term to those vocabulary?

clicking on save button will redirect to term listing page of our new vocabulary. now click on +Add term

 

Adding term

Once you have added all the term, you can view all of them on admin/structure/taxonomy/manage//overview

 

term listing

 

3. How to add terms to content type?
go to Manage >> Structure >> Content types

click on Manage fields for the content type , for whom you would like to add  taxonomy field.
in my case i have selected Article content type.
to add taxonomy click on +Add Field

 

Adding field

 

On settings page add no of term. limited/unlimited value selection from user end

 

Field setting

 

on this page admin can configure settings for taxonomy like label, help text, default value, reference method and choose vocabulary and click on Save settings.

 

content type setting for article

So, we are done with adding new taxonomy term to Article content type. Now we can go to content >> Add content >> Article >> Create Article

 

Create article

 

As we can see our custom taxonomy field “Geners of Books” with widget type autocomplete. you can change the widget type to Autocomplete, Select list from manage form display

Now it’s time to create content and test.
i’m too lazy to create content, so i have used devel to generate multiple nodes for the same content type.

page view

Clicking on Poetry at the bottom will redirect to taxonomy term listing page with specific term
url: drupal-8.0.2/taxonomy/term/14

In above URL replace drupal-8.0.2 with your own folder name or domain name where Drupal is installed.