Next Tutorial

Drupal 7 Tutorial Part 19: Understanding Drupal 7 Content Types & Fields Concepts !

Drupal 7 Tutorial Part 13: Drupal 7 Taxonomy, Vocabulary, Terms, Tags, Categories Concepts

Submitted by anilsagar on Thu, 11/03/2011 - 17:53

Hi Drupalers,

Nice to see so many drupalers are following my Drupal 7 tutorials. As per your choice i would like to discuss about Drupal 7 Taxonomy Concepts.

What is Taxonomy in Drupal:

  • Taxonomy is a concept in drupal which is basically used for categorizing content (nodes) in your drupal site. 
  • For example, let's say you have a content type called movie and you want to classify movies as Action, Horror, Romantic, Comedy, Drama etc then you need to know about Drupal 7 Taxonomy, Vocabularies, Terms or Tags etc.
  • Let's have a hands on using taxonomy concept by implementing it as explained below.

Vocabulary:

  • In Drupal vocabulary is nothing but a name given to group of terms which are used to categorize content. For example let's say you want to categorize movies as Action, Horror etc as discussed above then you will create a vocabulary named Movie Genre and then you will add above movie categories as terms inside this vocabulary.
  • Let's get hands on using Taxonomy concepts and categorize Article Content Type Contents into various categories as Sports, Business, Breaking , Political etc etc...
  • Let's create a vocabulary called "Article Type" and add above terms. To create a new vocabulary Login as administrator >> Click on Structure Link in the top black menu bar >> Then click on Taxonomy link at bottom to access list of vocabularies as shown below.

  • To create a new vocabulary click on Add vocabulary button as shown above and in the next screen Add Name as "Article Type" and Description as "Vocabulary to classify article content type." Then click on save. Once you create vocabulary you can see it in list of vocabularies as shown below.

  • Now let's start adding terms to our vocabulary. Terms are nothing but categories of articles which we want to classify as. To add terms click on add terms link next to Article Type Vocabulary.
  • You will see screen like below to add new term. Give name as "Sports Articles" and description as "Sports Related Articles List." URL alias as "articles/category/sports" which is Optionally an alternative URL by which this term can be accessed. Use a relative path and don't add a trailing slash or the URL alias won't work. We will see relations later just save the term.

 

  • Add some more terms to this vocabulary, let's say "Business Articles",  "Financial Articles", "Regional Articles", "Movie Articles".
  • Once you finish adding terms click on List tab as shown in above page to access list of terms under "Article Type" vocabulary. You will see screen like below.

  • As shown in above screen, you can any time edit any term using edit link next to the term. If you want to order terms use the drag & drop functionality. Be careful while drag & dropping if you drag to right terms will become child of top term, which will create hierarichal terms which we will discuss in next tutorial. Drag down to change order. After doing changes click on save button to save the order.
  • Now it's time to associate our content type Article with this vocabulary.
  • To do that, we need to add a term reference field to article content type. Login as administrator >> Click on Structure link on top black menu bar >> Click on Content Type link >> Click on Manage Fields link next to article content type to access below screen.

  • Create a new field of term reference type as shown above and click on save button. You will be redirected to next screen where you need to select vocabulary. Select vocabulary as article type and click on "Save Field Settings". Now you will be redirected to another screen as shown below where you can have some more settings related to term reference field.

  • All the settings are explained in above screen. Make necessary changes and click on save settings button. Finally, we finished associating a vocabulary to a content type.Its time to add some articles and classify them into various categories.

Adding articles and classifying them using Term Reference Field:

  • Add a new article content. To do this Click on "Content" Link in black menu bar >> Then "Add Content" link >> then "Article" to access screen like below.

  • Create a article and select Article Type as Business Article. If you want to associate more than one category then separate them by comma.
  • Repeat above step to create 3 - 4 different articles with different article types.
  • Now access any article that has article type associated with them. You will see something like screen below. You can notice the article type category links are appearing on the node page.

  • Now if you click on term links for example sports articles you will be redirected to page like some thing below which will list teasers of all articles which belongs to sports articles category. This way using taxonomy concept we can categorize drupal contents.

 

  • Finally, we learnt how to create vocabulary, how to associate vocabulary to content type, how to add terms, how to associate terms to nodes and the taxonomy concepts in Drupal 7.

Stay tuned with me to learn advanced taxonomy concepts like hierarichal terms, taxonomy fields in drupal 7 and new taxonomy features introduced in Drupal 7 in my next post.

 

Comments & Suggestions are welcome on tutorials :-)

 

Cheers,

Anil Sagar

22 comments

Step : Login as administrator

Submitted by Reza (not verified) on Thu, 12/27/2012 - 20:02.

Step :
Login as administrator >> Click on Structure link on top black menu bar >> Click on Content Type link >> Click on Manage Fields link next to article content type to access below screen.
and then click save, displaying error:
"There was a problem creating field katego: Table field_data_field_katego already exists."
im change to other field name(ex: listcategories) but diplaying same error.

Thanks for ur answer.

how to filter this content type

Submitted by suman (not verified) on Fri, 10/19/2012 - 17:56.

Sagar,

Its been a nice and helpful tutorial. Can you help me, know how to filter the contents. I am new with taxonomy. It would be great if you could post a link or something to such a tutorial. Thanking you in advance.

I have a question: Assume the

Submitted by Anonymous (not verified) on Wed, 09/12/2012 - 15:30.

I have a question:

Assume the following scheme:
-News
-Local
-Sport
-Politics
-International
-Politics

What are the differences of implementing the above using hierarchical vocabulary names VS terms?
i.e. Should "Local" be a child vocabulary of "News" or a term, where "Sport" and "Politics" will also be terms that are child to "News"?

What are the differences between these alternatives?

Thank you

Very helpful ... one question about taking the next step

Submitted by Brian (not verified) on Mon, 09/10/2012 - 01:18.

This tutorial was a godsend in getting me very close to where I need to be. Now I'm wondering if you or one of your visitors can help me get over the hump.

My situation: I have a vocabulary named "Subject." Within this, I have three vocabularies (News, Sports, A&E) that each contain multiple terms.

Having followed all of the steps of this tutorial, I now want to include News, Sports and A&E links in my main menu, and I'd like to have it set up so that if someone clicks the "News" link, they are taken to a page that list every story that has been categorized with at least one of the 11 news terms.

And I'd like to do the same so that any story categorized as one the 14 terms in Sports appears in that link, and the 8 terms in the A&E category.

Any suggestions?

Good Tutorial..Helpful for new developer.

Submitted by Anand kumar singh (not verified) on Thu, 08/23/2012 - 18:58.

Good Tutorial..Helpful for new developer.

Thanks for this tutorial.

Submitted by Ankit (not verified) on Thu, 07/26/2012 - 10:06.

Thanks for this tutorial. It's very useful to me. I have one problem related to views ticker. Can you know about views ticker in Drupal 7. I am getting very confused in ticker. If you have tried views ticker then please guide me for that.

Aliases path taxonomy

Submitted by elabdal83 (not verified) on Thu, 06/21/2012 - 20:20.

Hi,

I like this tutorial. But, I want to know How can I manage URL path Aliases with taxonomy content ?

Think you

thank you..THANK Yo0OUUUU....

Submitted by Anonymous (not verified) on Fri, 06/01/2012 - 21:29.

thank you..THANK Yo0OUUUU.... great explanation!

hello

Submitted by Mandy29 (not verified) on Tue, 06/12/2012 - 04:01.

good awesome post added your RSS.

hi, can you help me.

Submitted by Anonymous (not verified) on Wed, 05/23/2012 - 08:22.

I used taxonomy menu to create terms menu and navigate but in Home page menu(navigate) is a part introduction overview about website so I have to use Panel module and view module but I coundn't find any way to override default display taxonomy term with panel.
can you tell me to solve the proplem. thank you very much.

Great tutorial !!!

Submitted by Anonymous (not verified) on Thu, 05/03/2012 - 23:08.

I'm new to Drupal. Been fighting the issue for weeks on how to group (categorize) similar content and now I see how to do that. Now I am trying to figure out how to show ALL content for each term using main menu link, but will search later D7 discussions. Your tutorials are great - keep them coming.
Thx. Rick C.

VERY VERY GOOD

Submitted by LEON (not verified) on Fri, 03/30/2012 - 15:30.

VERY VERY GOOD TUTORIAL..THANK YOU

really very nice

Submitted by hardik (not verified) on Tue, 02/14/2012 - 12:31.

really very nice explaination. Keep adding such learning articles.

Thank you :-)

Submitted by anilsagar on Wed, 02/15/2012 - 10:39.

Thank you very much for your appreciation...

Cheers,
Anil Sagar

Really useful articles

Submitted by exhtml (not verified) on Wed, 02/08/2012 - 16:26.

Man, many many thanks for sharing your knowledge in such an comprehensive way. Hope you'll continue the series!

Sure

Submitted by anilsagar on Wed, 02/08/2012 - 21:38.

Sure I will Continue the series... Thank you very much for your appreciation :-)

Hii thanks for the tutorial,

Submitted by ery (not verified) on Fri, 02/03/2012 - 02:32.

Hii thanks for the tutorial, it really helped me. nice work bro :)

Thank you :-)

Submitted by anilsagar on Fri, 02/03/2012 - 17:48.

I am glad... Thank you for taking your time to appreciate...

Cheers,
Anil Sagar

showing horizontally

Submitted by niraj (not verified) on Mon, 01/30/2012 - 04:50.

Hi sagar,
I am new to drupal 7 and i have been searching for showing Taxonomy Terms horizontally in a post because when you create more than a 1 taxonomy terms for a article then they automatically lined up as vertical sequence.
for example:
i created a page
which has 3 taxonomy terms assigned but when i publish them the appear as below:

Article Type:
Technology

Location :
London

Writer:
XYZ

but i wish them to be displayed as following:
Article Type: Location : Writer:
Technology London XYZ

How to do like above?
i looked around CSS but could not figured out.
your prompt reply would be greatly appreciated.

Thanks

Use Float Left in CSS

Submitted by anilsagar on Mon, 01/30/2012 - 12:49.

Hi Niraj,

This is very simple. Use float:left attribute in css.

I am not a css guy. But above should solve the issue.

Cheers,
Anil Sagar

nice !

Submitted by Anonymous (not verified) on Tue, 01/03/2012 - 09:11.

very brief explanation,
nice tutorial. it's always confusing me how to categorize content on drupal before i found this article.
thanks.

Nice Articles

Submitted by Anonymous (not verified) on Wed, 11/09/2011 - 11:16.

Nice Articles

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.
©2010 AnilSagar. All rights reserved. Drupal theme by Kiwi Themes.