Back to top

Pathauto Development Update - And a Call to Use Tokens

I feel very happy today and I think you should feel happy too. Pathauto is a great module that has served millions of visitors to thousands of sites very well over the years. But Pathauto, along with all of Drupal, is getting a little bit better!

Enter Token Module

At the very end of 2006 Jeff Eaton started work on a token module which took the pattern logic out of Pathauto into its own module (and extended it a bit further). All those little strings of text like [title] and [cat] and [user] which Pathauto uses were all placed into a separate API. This provides two great benefits - first, it makes them available to other modules such as the custom breadcrumb, autonodetitle and other modules. Second, I instantly recognized the personal benefits from this decision because the token parsing part of Pathauto was the source of most of the bugs. I thought that if I outsourced the patterns I'd also outsource the bugfixing! In the end I'm now a co-maintainer of the token.module providing some bug fixes, features, design reviews for the module. At least I have a partner in crime on the issue and at least the work can benefit all of Drupal instead of just Pathauto users.

Call to module developers

This call is two fold:

First, to modules that implement pathauto hooks: now's the time to start implementing the token hooks. This will open up your module to interaction with a much broader set of modules and is a much better long term solution than the Pathauto hooks. To learn more about token or discuss it's use, join the tokens group on

Second, to all module developers: when you find yourself re-writing code to parse out some values from an object and then strtr a message - STOP! That's the exact use case for token, so use it and you'll be glad you did. The more people using it the more robust it will become. The more robust it becomes, the more we all benefit.

Support for Pathauto

Also, I'd like to thank the team at pingVision (and, frankly, my fabulous boss) for the support in ideas and time to help improve Pathauto. pingVision benefits greatly from the effort of other Drupal developers and it's important to us that we give back to the community. Hence they sponsored some of this work. If you believe in that and live near us, we're hiring ;)

I also received support from the folks at AlianDesign for this work and another feature I hope to finish up in this 2.x branch.

I have also received assistance in code and code reviews from add1sun, RobRoy, LyricNZ, fgm, and am looking forward to assistance from BenK with a benchmark on path aliases which will be really useful to folks in deciding how to implement Pathauto.

Call for Testers

I'm following two paths on this front - first, I always believe in just letting people test it out on their sites and then report bugs back. With this round of Pathauto I'm also developing a set of selenium tests which will allow for automated testing of Pathauto. Selenium is a really brilliant tool that automatically clicks and enters information into your web application. My goal is to build up a set of automated tests in Selenium that can easily be run to ensure no regressions are introduced. Building tests is not difficult and they are enormously valuable, but it takes time. If you are looking for a way to give back that doesn't involve code/docs/money, this is a great way to get involved and learn new tools. I'll be happy to mentor anyone interested in helping with automated testing.

People Involved: 


help me learn to test token

Hey Greggles.

Thanks for getting thru that diagram with me.

We should put some finishing touches on it when you are ready for your slides.

I am using this channel to inquire about how testing token is done, esp towards it being put in core for Drupal 7.x.

I'd help you with testing in any way that I can.

I am reading up slowly on the simpletest module and hope that you will light the way a bit.