1

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?

thanks!

1

hook_pathauto_alias_alter is nearest to your query.

First parameter $alias will be newly created alias by pathauto. You would have to analyze it with some regex pattern for undesired pattern generation.

The second parameter will give you contextual picture of item in associated array.

module definitely be taxonomy_term
source system path of taxonomy e.g. taxonomy/term/<tid>

I think you will have pretty much to analyze the term and get its hierarchical info to update $alias variable.

0

What about path_save() called X number of times with whatever tokens you want in the URL fragment.

What you're asking isnt really a pathauto question I think -- as the uniqueness you describe is pretty subjective, eg. "whats the most important Venice!? -- who the heck knows :P" ...

You could keep a one-to-many db table of NIDs -> allowed aliases you want per city ...

The module would be fairly simple I think ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.