How to Generate URL Aliases using Pathauto in Drupal 8

Submitted by Rajasekhar on Sat, 12/08/2018 - 07:14

The Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users) without requiring the user to manually specify the path alias. This allows you to have URL aliases like /category/my-node-title instead of /node/123. The aliases are based upon a "pattern" system that uses tokens which the administrator can change.

Requirements: Install below module also with the Pathauto module.

  • Token
  • CTools

Follow below steps:

  1. Install and Enable Pathauto, Token, CTools (Chaos tools) modules.
  2. Configuring Pathauto, Go to Admin -> Configuration -> Search and metadata -> URL aliases ->Patterns.

 

  1. In the above image, already Pathauto pattern is created for article content type. If you add new article content type automatic generate alias is available for article content. See below image.

  1. After click on save, the Pathauto will generate automatic alias as per article pattern. Of course, if you want to give specific URL alias then you can uncheck the generate option and enter your own alias.
  2. Adding pattern for total Content – This pattern will create aliases for all the content type available. For example, Article, Blog, Note etc.
  3. Click on Add Pathauto pattern and select the options and enter pattern as required. I am selecting all content type and given a content label.

 

  1. After that click on Save and add contents. Now the Pathauto will generate automatic URL alias for all contents.
  2. For example, Path Pattern: [node:content-type]/[node:title] = Alias: article/drupal.

 

  1. After enabling and added pattern, now the path alias are automatically generated only for new content. But to change the alias for existed content we want to update alias using Bulk Generate option manually.

 

  1. Before generating you can also delete existed alias using Delete aliases option as shown in the above image. Then generate Bulk generate for existed content as shown in the below image.

 

  1. That’s it, now every content has its own aliases with node title. Also, you can add patterns for particular content, taxonomy, and page as same as the content pattern. For example, see below screenshot.