How to Create a Custom Taxonomy Term URL Using Drupal 8

By Thomas Kaisuka | |

How to Create a Custom Taxonomy Term URL Using Drupal 8

The first Step Here is to ensure you have TVI (Total Views Inetegrator) installed. Reason i love this module is that it gives you ability to customize views display listings each taxonomy vocabulary or term or even children of parent terms. 

This gives taxonomy terms having their own urls a meaning.

Taxonomy Views Integrator In Action
Taxonomy Views Integrator In Action

Okay, let's proceed to the Nitty Gritty Of This Post;
 Using the Redirect Module  one can construct a URL Alias pattern per taxonomy vocabulary. This will be taken on by the terms and sub-terms of the particular taxonomy vocabulary of interest.

Lets look at our "News Type" Vocabulary for example; (You'll notice that label has Blog Category not News Type which was my original naming and hence will be the machine name no matter what my new label is to avoid messing up the site URLS in future)
 

News-Type-Category
This is my news type category



-------------------------------------

Sample Screenshot TERM URL
When i edit the news term it gives me options to either do a custom URL or configure a URL pattern that will make a uniform pattern for all other tems in this vocabulary



Lets now create a URL pattern for our News Type (Blog Categorization) vocabulary;
 - Go to configuration > search and metadata > URL aliases and configure a URL pattern;

  

Create-Taxonomy-URL-Pattern-1


-------------------------------------

 

Create-Taxonomy-URL-Pattern-2

 



-------------------------------------
 

Create-Taxonomy-URL-Pattern-4




-------------------------------------

Create-Taxonomy-URL-Pattern-5

 


You can now reference the Taxonomy vocabulary in any entity type to categorize your content.

In this case as you can see in this blog, i used the Drupal Byte term under my news type (blog categorization) vocabulary and the results were as follows;

 

Taxonomy-Term-Link-In-Views



-------------------------------------
 

Taxonomy-Term-Link-IN-URL