Drupal 8 - Convert taxonomy term id URL into alias URL

By xngo on June 22, 2019

In Drupal, by default, the URL path for taxonomy term page is ..../taxonomy/term/3. Well, as you can see, the URL is not very meaningful. However, by installing Pathauto module, you can convert that URL into something like ..../taxonomy/term/python, which is much more meaningful to Google web crawlers.

Setup URL alias pattern

  1. After you installed and enabled Pathauto module, navigate to Configuration > URL alias.
  2. Under the Patterns tab, click on Add Pathauto Pattern to create a new pattern.
  3. Set the Pattern type to Taxonomy term.
  4. Set the Path pattern to the way that you like, e.g. taxonomy/term/[term:name]. Note: The Browse available tokens link will show you all the possible patterns that you can use.

D8 - Show taxonomy term URL pattern path

Regenerate URL

  1. After your pattern has been set, head over to the Bulk generate tab.
  2. Select Taxonomy term.
  3. Generate a URL alias for un-aliased paths only

D8 - Bulk generate settings

Clear the cache

After you regenerated all the URLs, you will not see the effect until you clear you system's cache. Navigate to Configuration > Performance and then click on Clear all caches.

D8 - Show clear cache settings

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.