Is there anyways to make an alias as short as possible, without duplication?
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.
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?
thanks!
Comments
Comment #1
dave reidNo, this is not really possible with stock Pathauto. You'd have to write a custom token if you wanted this behavior to work differently under different conditions.
Personally I would just recommend using a hierarchy like [country-abbreviation]/[state-abbreviation]/[city] to give consistent URLs like:
us/fl/venice
us/ca/venice
it/venice (since [state] would be assumed to be empty in this case)