Drupal Pathauto Module - A Brief Tutorial on how to Automatically Generate Bulk URL Aliases in Drupal 8/9

Everyone that has ever used Drupal will not doubt noticed the ugly paths such as /node/1

Thankfully, there a module for that is make is a more readable URL and SEO friendly. Most of you probably already aware of Pathauto module as the contrib module that takes care of this problem. If you don't then i want to share this really well written tutorial by Specbee with you.

By default, Drupal implements a "node/nid" URL path system. When you create your first node in Drupal 8, the default URL path looks like ”/node/1”, and the next one will look like “/node/2” and so on. This not user-friendly nor is it very SEO-friendly. Search engines always prefer URLs that are more descriptive of the page content, clean and legible. Using the Drupal 8 Pathauto module, you can obtain a path that looks like this -> "/category/my-node-title". The Pathauto module also eliminates the need to manually create path aliases for every type of content on a Drupal site. When you have an existing site with plenty of content, you can leverage the Bulk generate option in the Drupal Pathauto module to automatically generate aliases for them in a jiffy. Let’s learn how to configure and implement this time-saving Drupal module. The Pathauto module is also Drupal 9 compatible.

What does the Drupal Pathauto Module do?

The Drupal 8 Pathauto module enables automatic generation of URL/path aliases for different kinds of content like nodes, taxonomy terms and users. All of this without the need for the user to manually enter the path alias. So instead of a URL that looks like /node/1, the Pathauto module lets you create URL aliases like /category/my-node-title. Thus, giving your users a much better idea on what to expect from the web page. Without Drupal Pathauto, creating a URL structure is time-consuming and error-prone. The site admins can specify a pattern to follow for different types of content. The Bulk generate option lets you automatically generate or regenerate aliases for pre-existing content as well. 

Getting Started with the Drupal 8 Pathauto module

Installing

Installing the Drupal 8 Pathauto module is like installing any other contributed module. I’m using the Composer to install since it automatically installs all of the necessary dependencies and Drush commands to enable the module. However, if you choose to install manually, make sure you also have the latest versions of the CTools and Token modules installed. 
Open the terminal, within the project enter the following command.

      $ composer require drupal/pathauto

      $ drush en pathauto

Configuration

1.    Create Drupal URL alias Patterns 

  • Configure Pathauto patterns as required in Configuration -> URL aliases -> Patterns.
  • Click "Add Pathauto pattern"Drupal Pathauto Configuration

     

  • Select the Pattern Type. For example, if you are generating URL aliases for nodes, you should choose “Content” as the Pattern type.
  • Add the path pattern to the textbox, and you can browse available tokens for the pattern. When you click on the link, available options will show up. For example, I used the [node:title] pattern. So, the URL will be http://yourdomain.com/node-title
  • Select content type or you can also leave it empty. This pattern will be used for all content from the Content Type dropdown.
  • Enter the Label field which helps in identification of the pattern.
  • Hit the Save button. 
     Pathauto-Module   
  • Back on the Patterns tab, you will now see that the Pathauto pattern has now been createdPatterns tab in pathauto module

     

2.   Generate Bulk URL aliases

  • Go to the Bulk generate tab for the entity type you want to bulk generate the aliases and click Update.
     Bulk URL Aliases Generation in Pathauto Module
     
  • Now you have created the URL aliases automatically.Pathauto

     

  • Now Click on one of the Alias just generated and the page will display the Content with the user-friendly URL as shown belowUrl Generated

     

3.   Deleting Aliases

You can also batch delete aliases from the “Delete aliases” tab. You can either choose the entity types you want to delete, or you can bulk delete all aliases. You can choose to delete the aliases that you automatically generated. This will not affect aliases created manually. 

 

Pathauto-Module

 [source: https://www.specbee.com/blogs/drupal-pathauto-module-brief-tutorial-how-automatically-generate-bulk-url-aliases-drupal-8]

The content of this field is kept private and will not be shown publicly.
Your email address will be kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.