Understanding and Using Taxonomy
While you can organize your content based on content types and content authors, you may also want to organize or view content based on what the content is about or what it pertains to.
For example, let's say you have 3 locations and events happening in all those 3 locations. Visitors to your site may not want to look through your entire calendar at events across all of those locations; they may want to see only the ones happening close to them. What you want is a way to categorize your events by location, and allow your visitors to filter the events by location.
Taxonomy allows you to associate descriptive terms with your content, which can be used to organize and display the content on your site. Each set of taxonomy terms is part of a category called a vocabulary. Terms in vocabularies can be further broken down into sub-terms.
Vocabulary - 'Event Type'
- term 1 - 'Author Signings'
- term 2 - 'Book Club'
- term 3 - 'Kid Friendly'
CREATE THE VOCABULARY
Navigate to: Structure > Taxonomy > Add Vocabulary
- Enter a name for your vocabulary - Example: ‘Event Type’
- Description (optional) - for this example we’re using 'Taxonomy terms for our Events'
- Select ‘Add Terms’ for the vocabulary you just created
- Enter a term info in the ‘Name’ field - Example: 'Author Signings'
Repeat steps 5 & 6 until all terms have been added.
ADD THE TAXONOMY TO YOUR CONTENT TYPE
Navigate to: Structure > Content Types > Event (or the content type of your choice > Manage Fields
Add new field
- Label: Enter the label, for this example we’re using ‘Event Type’
- Field Type: Term reference
- Widget: Checkboxes/Radio Buttons
- Select your ‘Vocabulary’ - for this example it would be ‘Event Type’
- Save field settings
- Select ‘Required Field’ - this is recommended to make sure every event is properly categorized.
- Save Settings
CREATE THE EVENT
Navigate to: Content > Add Content > Event (or content of your choice)
(For already existing nodes you can navigate to ‘Content’ and edit the appropriate selection to include a ‘Taxonomy’ term - step 6).
There are several available fields for you to utilize to create the content of your page:
Title: This text will be used in 4 places:
- The title on your browser window
- The header on your published page
- It will also be used to construct the actual URL of the page
- The Event name displayed on the ‘Event Calendar’
- Body: Use the built in WYSIWYG editor to add text, images, links, and any type of content that tells visitors about the event. Not familiar with the WYSIWYG icons? Place your mouse to hover over an icon and it tells you what it is for.
- Event Date: The start date/time and end date/time appear on the event page itself and also determine where the event is placed on the ‘Event Calendar’
- Event Address: Will appear on the event page
- Books: Are there specific books associated with this event? Add them here.
- Select an ‘Event Type’ (these are the Taxonomy terms you previously created)
You can customize the settings of any of these tabs to your preference:
- Menu Settings
- Book Outline
- Revision Information
- URL Path settings
- Meta tags
- Authoring Information
- Publishing Options
Now when you view the page, you should see the selected vocabulary terms displayed towards the bottom of the page. By selecting a term, the visitor will be provided a list of all other events under the same category.
Want to learn how to use ‘Taxonomy' to filter with 'Views'? Review 'Filtering by Taxonomy’
The Drupal default is to display taxonomy terms stacked; if you have content with more than one taxonomy term selected, each will be displayed vertically - one on top of the other. If you would prefer to display taxonomy terms 'inline' (or horizontally) an ABA staff member can enable the required modules for you to do so.
- Email email@example.com to let us know that you would like to display the taxonomy terms inline. We will enable the necessary modules. Once you receive confirmation that the modules have been enabled, continue with these steps.
- Navigate to: Structure > Content Types > Event (or the content type of your choice > Manage Display
Under 'Add new group' fill in:
- Label: You may name this anything you like, for example: Event Types
- Group Name: Group_Tags
- Format: Inline Elements
- Drag and drop the taxonomy term reference fields for each vocabulary so that they become children of this new group.