Skip to main content
1 of 3
David Barratt
  • 977
  • 1
  • 13
  • 29

Is there a way to make aliases as short as possible?

For instance, if you have three tokens, let's say [city], [state], and [country] is there a way to do this:

/[city]-[state]-[country]

and then let's say there are three cities, Venice, in different places the first, Venice, Florida, United States would get this url

/venice

the second, Venice, California, United States would get this url

/venice-california

the third, Venice, Italy would get this url:

/venice-italy

Notice that it does not cut an individual token, only cuts off the extra tokens as they are not needed (in the case of Italy, there is no state so pauthauto automatically skips this token). From reading the documention, it looks like Pathauto's default behavior is to do this:

/venice

/venice-1

/venice-2

and so on... when what I want to do is make the first one the "venice" and any additinal ones get additial tokens as needed, so if Venice, Italy is first then they will get /venice

If there's a way to do this with pathauto, how would you do it? If not, what's the best way to make a module that does this? Can a module modify how pauthauto works without modifying pathauto itself?

thank

David Barratt
  • 977
  • 1
  • 13
  • 29