Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tdave00 on
I have a node content type that requires users to choose two vocabulary terms from before submitting. How do I setup pathauto to take these two vocabulary terms and use them as the url?
Automated Alias Settings Picture
I have two vocabularies (Cities and Categories) that the user has to pick from. I want the url to take the first term and then the second term. For example: http://example.com/nashville/auto_parts .
Any ideas?
Comments
Bump.
Bump.
Subscribing, same question.
Subscribing, same question. I can only figure it out from one vocabulary.
greetings, Martijn
Still looking
I'm still looking for this solution, if anyone has it, or a link to it. It would be much appreciated!
It would be right proper to be able to insert ["myVocab":termpath-raw]
as a pattern instead of having to use the primary one.
Or even better would be the functionality to have a URL alias for each term in the termpath for use in PathAuto or any other module. I guess that's a feature request, eh?
Anyone with any light on this?
Thanks
-Tre
_
You'll find more information on the status of this feature request at: http://drupal.org/node/185446
Cheers,
Deciphered.
A workaround
I also hit this problem where I had a vocabulary of towns / venues and another of labels / bands.
I wanted to create a "gigs" node with a url containing town/venue/band
The venue and band are selected from the two taxonomies as part of the node creation/update.
The following workaround works for me:-
Using the Automatic Nodetitles module (http://drupal.org/project/auto_nodetitle), I set the option "Automatically generate the title and hide the title field" within "Automatic title generation"
This option allows pre-population of the node title.
I also checked the "Evaluate PHP in pattern" option and inserted the following code in the "Pattern for the title" textarea.
This code populates the title field with terms from taxonomy 1 (Labels & Artists) which is the more heavily weighted taxonomy in my site.
Then, I set the "Node path settings" within "URL aliases" for the relevant node type to "gigs/[termpath-raw]/[title-raw]".
As the title contains terms from the heavier taxonomy, the final path contains terms from both taxonomies.
Obviously the PHP code used in my example could reference many taxonomies, but this method does rely on not needing the node title for anything else.
HTH
Terry
Recent Drupal sites:-
www.allegiantair.com www.defaqto.com www.quarkexpeditions.com www.sportrelief.com www.chevronhackles.com
www.philipturnercrafts.co.uk www.intelflexplus.com www.aprilroseturner.com www.businessclubagent.ihg.com www.businessclub.ihg
Cool idea. In my case
Cool idea. In my case unfortunately, I need the node titles though.
I think this feature shouldn't be so hard to do. I mean, I have a module that does it already. It just doesn't work all the time and I don't know PHP or other programming at all. The person that made this module for me did it quite quickly (like, a day), but then disappeared instead of debugging it so it works all the time.
Use a CCK computed field?
If you need the node title, could a CCK computed field (http://drupal.org/project/computed_field) be used to hold the terms from the second taxonomy?
HTH
Terry
Recent Drupal sites:-
www.allegiantair.com www.defaqto.com www.quarkexpeditions.com www.sportrelief.com www.chevronhackles.com
www.philipturnercrafts.co.uk www.intelflexplus.com www.aprilroseturner.com www.businessclubagent.ihg.com www.businessclub.ihg