How do I use the Pathauto Module for Drupal SEO?

https://www.drupal.org/project/pathauto

The Ctools module is required: https://www.drupal.org/project/ctools

The Pathauto module generates URLs for your content without requiring you to enter the path alias manually. In other words, if the title of your new blog post is “My Big Cat” then Pathauto will set the URL to yourDrupal8site.dev/my-big-cat instead of yourDrupal8site.dev/node/23. Putting the right words in the URL is great for SEO, so this module is essential to your project. If you don’t use the Pathauto module, you must remember to create every single content URL on your website manually.

How do I install and enable the Pathauto Module?

  1. Install the Pathauto module and required Ctools module on your server.
  2. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit http://yourDrupal8site.dev/admin/modules.
  3. Select the checkbox next to Pathauto and click the Install button at the bottom of the page. You may get a message asking for your permission to install the Ctools module. If you do, click the Continue button.

If necessary, give yourself permissions to use the Pathauto module.

  1. Click Manage > People > Permissions (Coffee: “perm”) or visit http://yourDrupal8site.dev/admin/people/permissions.
  2. Select the appropriate checkboxes for * “Administer pathauto” * “Notify of Path Changes”
  3. Click the Save permissions button at the bottom of the page.

How do I configure the Pathauto module for Drupal SEO?

The Pathauto module adds four tabs to the URL aliases admin page. They are Patterns, Settings, Bulk generate, and Delete aliases.

  1. Go to the Pathauto admin page: Click Manage > Extend (Coffee: “URL aliases”) or visit http://yourDrupal8site.dev/admin/config/search/path/patterns.
  2. Click on Settings. The default settings are fine for most websites but check them to be sure that they haven’t been changed. An important setting to double-check is the update action. Ensure that Create a new alias. Delete the old alias. is selected.
  3. If you changed anything, click the Save configuration button at the bottom of the page.
  4. Click on the Redirect module settings link just below the Update action section.
  5. Update your settings to match those in the box above:
  6. Select “Automatically create redirects when URL aliases are changed”.
  7. Select ‘Retain query string through redirect”.
  8. Set Default redirect status to “301 Moved Permanently”.
  9. After any changes, be sure to click the Save configuration button at the bottom of the page.

A Brief Overview of the Token System To fully take advantage of patterns, you need to understand a little about the Token system. Tokens are variables in Drupal. There are thousands of Tokens available for you to use. To see what they are and get a better understanding of how they work you can visit http://yourDrupal8site.dev/admin/help/token.

For now, we are going to focus on just a handful of critical Tokens that we’ll use to create our URL path patterns. They are: [node:title] – The title of the piece of content being displayed. [term:vocabulary] – The vocabulary (top-level category, so to speak) of the current term.

[term:name] – The name of the current term (bottom level category).

How do I create Drupal Pathauto Patterns?

Drupal URL paths operate in patterns. Instead of creating a path to every single piece of content, it’s better to specify a pattern (using tokens) for groups of content. Drupal will follow the pattern to create the path for each new piece of content, ensuring consistency across your website. You’re going to add a Pathauto pattern for each Content Type and taxonomy that you have.

  1. On the URL alias > Pattern tab (or visit http://yourDrupal8site.dev/admin/config/search/path/patterns) , click the + Add Pathauto pattern button.
  2. From the Pattern type drop-down, select Content. Several more fields will be displayed.
  3. Fill out the fields as shown. A. Path pattern: “[node:title]” B. Content type: select “Article” and “Basic page” C. Label: Anything goes. I use the name of the Content Types: Articles & Basic D. Select the Enabled checkbox.
  4. Click the Save button near the bottom of the page. The resulting page will look something like this:

The [node:title] will be replaced with a normalized version of the title of the content. Drupal will turn the letters lowercase, replace spaces with dashes, and remove any odd characters.

  1. Repeat for each of your Content Types.