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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 10 ■ Creating Pages<br />

At this point all of the blocks that are defined to be site-wide blocks will appear on the page, along<br />

with the article for <strong>Drupal</strong>Con. But what if you wanted more things to display on this page other than the<br />

standard blocks and the article? The answer is to use Views to generate blocks from content, or use the block<br />

interface to create or assign a block to appear on this page. Let’s begin by creating a custom block through<br />

the “Block layout” page and assigning that block to appear only on the <strong>Drupal</strong>Con page (see Chapter 8 for a<br />

refresher on blocks):<br />

1. Click the Manage link in the top menu followed by the Structure link in the<br />

secondary menu. Click the “Block layout” link to display the “Block layout” page.<br />

2. Click the “Add custom block” button to create a new custom block.<br />

3. In the “Block description” field, enter “<strong>Drupal</strong>Con 2015 Los Angeles.”<br />

4. In the Body field, enter “May 11-15, 2015 in the Los Angeles Convention Center.”<br />

5. Click the Save button.<br />

6. On the “Configure block” page that appears, locate the Region select list and<br />

set the region to “Featured top” (if you are not using Bartik, select another<br />

prominent region).<br />

7. To restrict which pages this block will appear on, click the Pages tab in the<br />

vertical navigation bar and, in the Pages text area, enter the URL associated with<br />

the article you created, starting with /node. For my example, it’s the first article<br />

that I’ve written on the site, so the value that I will enter in the box is /node/1.<br />

Next, click the “Show for the listed pages” radio button, as we only want this<br />

block to appear on our article’s page.<br />

8. Click the “Save block” button to save the new block, and then navigate back<br />

to the article page that you are working on by clicking the Content link in the<br />

secondary menu and clicking the title for the article in the list of content.<br />

After adding the block you should see something similar to Figure 10-2.<br />

Figure 10-2. Adding a block to an article detail page<br />

119

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

Saved successfully!

Ooh no, something went wrong!