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 2 ■ Creating and Managing Content<br />

will increase by 1 for each node we add. Although http://localhost/node/1 gets us to the content that we<br />

wanted, the URL is not very people- or search-engine-friendly. Fortunately, <strong>Drupal</strong> lets us override the URL<br />

to something that is more understandable and representative of the content on the page being displayed.<br />

Click the Edit tab or hover over your content item and click the pencil icon and select Edit. In the right<br />

column, click URL Path Settings. <strong>Drupal</strong> lets you create an alias, or an alternative URL, to the same content<br />

item as http://localhost/node/1. In the “URL alias” field, enter a more descriptive link than node/1. For<br />

example, if the article describes recreational boating, you might enter “recreational-boating” in the “URL<br />

alias” field. Note that you only enter the URL portion after the base URL of your site; for example, if your site’s<br />

URL is http://example.com, there is no need to enter http://example.com in the “URL alias” field, only the<br />

descriptive portion of the URL (see Figure 2-16).<br />

Figure 2-16. Changing your content’s URL to a more descriptive one<br />

■■Caution<br />

You must use hyphens, underscores, periods, or other characters to separate the words in your<br />

URL. Spaces between words will not work.<br />

After entering the new URL alias, click the “Save and keep published” button at the bottom of the<br />

form. <strong>Drupal</strong> will redisplay the page using the new alias URL that you created. In our example, the new<br />

URL is http://localhost/all-about-boats. The new URL is easy for a human to understand and, more<br />

important, easy for a search engine to pick up: the URL better indicates the content that the page provides.<br />

Creating alias URLs is an important aspect of creating content on your website. However, manually<br />

creating an alias for every content item is tedious. Fortunately, there is a <strong>Drupal</strong> module that automatically<br />

creates a URL alias for every content item saved on your site after the module is installed and enabled.<br />

That module is called Pathauto and was introduced in Chapter 1. I’ll cover the installation of modules like<br />

Pathauto in Chapter 8.<br />

Authoring Information<br />

Once again, click the Edit tab or use the pencil icon to edit a content item. Click Authoring Information in<br />

the right column, and you’ll see the screen shown in Figure 2-17.<br />

Figure 2-17. Enter author information here<br />

19

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

Saved successfully!

Ooh no, something went wrong!