18.11.2015 Views

Beginning Drupal 8

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating Taxonomy<br />

Chapter 20 ■ Building a Company Site<br />

The corporate site utilizes the Article content type for a variety of purposes, including for news articles, blog<br />

posts, and service offerings. To enable this capability, we’ll create a new taxonomy vocabulary called Article<br />

Type and create terms for Blog Post, News, and Service Offering.<br />

To create the vocabulary, navigate to Structure ➤ Taxonomy and click the “Add vocabulary” button to<br />

create the new container for topic terms, and name the vocabulary “Article Type”. Add each of the terms in<br />

preparation for assigning the vocabulary to the Article content type. After creating the vocabulary and terms,<br />

the listing page for the Article Type vocabulary should appear as shown in Figure 20-2.<br />

Figure 20-2. The Article Type vocabulary<br />

Updating the Article Content Type<br />

The next step is to create a new field on the Article content type for capturing the type of article being created<br />

(Blog Post, News, or Service Offering). To create the field, click the Structure link on the secondary admin<br />

menu, followed by the “Content types” link on the Structure page. Click the “Manage fields” link for the<br />

Article content type and create a new field of type “Term reference,” using the Article Type vocabulary as the<br />

basis of the values to be selected for this field. For details on adding fields, refer to Chapter 5. After adding<br />

the field to the Article content type, creating a new article should appear similar to Figure 20-3 with the<br />

terms listed from the Article Type vocabulary.<br />

213

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!