Learn how to create taxonomy vocabularies and create terms.
We’ll cover the following:
- Create a product category and product tags vocabulary
- Create terms
- Reorder terms
In the previous video, you learned about the taxonomy system at a high level. Now, let’s do some actual site building. What we’ll do now is create two vocabularies, product category and product tags. Product category will allow us to categorise products into a single category and product tags will be used to tag products. So, let’s start things off by creating the product category vocabulary. And we can create it from this page. And to access this taxonomy page, just go to structure and then click on taxonomy. So, let’s click on add vocabulary. And in the name field, I will enter “Product category.” And in the description field, I’ll add “Used for categorising products.” And then, click on save.
Let’s now add in some taxonomy terms. And another way to think of a taxonomy term is that think of it as a category item. So to create a term, click on add term. And the first one will be auto, and then I’ll click on save. And the second will be software, and then I’ll click on save. The third will be tech. And the final one will be hosting. Let’s go back to our vocabulary list. Another thing you can do is you can add in some description texts for each taxonomy term. So if we click on hosting, here you can see that we have a single title on this page. But if we go back and edit the hosting term, we can add in some description text. So if I add in “Hosting…” into the description field and click on save, and they would go and view the hosting index page, you can see this description text is being displayed below the heading.
So if you want to add in a bit of text to your taxonomy term index page, you can do so via the description field. Let’s now go back and I will remove that description text. Another thing you can do from this list page is you can reorder the terms. So if you want, you can move tech all the way to the top, and then click on save. You can even adjust the terms in a hierarchical order. So let’s say we want hosting to be under tech and also software to be under tech, but you can take things even once if further and move tech under auto as well. And then, you could even move software under hosting as well. And then if we click on save, you can see we have a few levels right here. And then if you want to reset the order, you can click on reset to alphabetical. But before you click on that button, you will need to reset the order. So let’s just move it all back in, and then click on reset to alphabetical. And then, this will reset in alphabetical order.
And finally, I should mention that taxonomy terms are fieldable. That is why you can see the manage fields, manage form display, and manage display. If you need to, you can add custom fields to this vocabulary and the field will appear on the term edit form. Now, let’s create the product tags vocabulary. So let’s click on taxonomy in the breadcrumb, and click on add vocabulary again. And in the name field, I’ll enter in “Product tags.” And in the description, I’ll add “Used for tagging products.” And then, click on save. We won’t create any terms because they will be created when you tag a product.