Pathauto | Drupal 7 – Part 3: Pattern for Taxonomy term

Pathauto | Drupal 7 – Part 3: Pattern for Taxonomy term

Now, in the previous video we have explained how to generate a path from a term reference field In this video, we will explain how to create a better path for a taxonomy term to cater for a multi-level taxonomy Let’s first go to pattern page Let’s go to configuration Search and metadata URL aliases Patterns Scroll down This is our taxonomy term’s path We use only Vocab and term name to form the pattern Let’s go to taxonomy we created earlier Go to Structure Taxonomy Category Right click on the mouse and open in the new tab Let’s click on this Click on “Fashion” Well, the path is just nice Category /Fashion Let’s go back What about “Shoes” this time Now, “Shoes” is the third level You can see that it doesn’t join it’s parents’ terms Which are “fashion” and “men” into the path So, let’s improve the pattern a bit for the taxonomy term path Back to our pattern page now Let’s add one more token in between the vocab and term’s name Type “/” Place our cursor in between the two slashes “/” So, we are going to fill the token in between here Let’s click on “Replacement Patterns” Taxonomy Terms Go down Parents Joined path and click on this token’s link Yes, it has already filled it up Great ! That’s it! So, let’s scroll down and save the configuration Back to the term page Let’s update the path.. Edit scroll down. and check “Generate automatic URL alias” Click “Save” Now, let’s view That’s great! A full path has now been generated We have category /fashion /men /shoes so, fashion and men are the parents of shoes’ term Now, let’s go back to our taxonomy page again Structure Taxonomy Category Let’s try.. “Women” this time As you can see, this is the old path that has not yet been updated So, click “Edit” Scroll down check this and click “Save” view great ! parent has been joined to the path Now.. possibly you have noticed something by now that’s every time when you update for a particular entity like content type taxonomy or even user the checkbox “Generate automatic URL alias” will be unchecked Now, the checkbox I meant is this Structure>Taxonomy Category Let’s click on the “Clothing” Edit go down this is the checkbox I’m saying every time when you update the pattern for this taxonomy this checkbox will be unchecked automatically that’s mean the old path are not affected by your new pattern unless you update them manually Now, if you want all the paths to be updated at one time Then you can do a “Bulk Update” instead of doing it one by one as I did just now So, let’s go to the pattern page again Let’s go back here Click on “Delete Aliases” tab check “Taxonomy terms” and delete aliases now Go back to “Bulk Update” check “Taxonomy term paths” and update Let’s click on “List” and sort by “System” one more time Now, as you can see All your taxonomy term paths have been regenerated followed the new pattern Now a final note to you You have to be careful when changing the pattern path on the live site Google might already have indexed your links and paths So if you update all the old paths You may have to use some redirection modules to ensure all your old paths be redirected to the new one correctly else people will be led to the unfound page Ok ! Hope you have learnt something useful from our tutorials Remember to subscribe to our channel for more interesting sharing to come Stay tuned ~

About the author


Leave a Reply

Your email address will not be published. Required fields are marked *