0

With Pathauto, is it possible to use the url of a node's term as a token?

In case it makes a difference im using the Taxonomy Menu module aswell. Thanks

UPDATE - The taxonomy is hierarchical. So if I have:

Food/Pizza/Margareta

Then if a node is tagged with 'Margareta' I need the path to be:

Food/Pizza/Margareta/node

1 Answer 1

3

Taxonomy terms are attached to nodes using term reference fields in Drupal 7. As such, you have access to the term reference field just like any other in the list of replacement tokens.

Look for fields related to the node with a description of "Term reference field", e.g.

enter image description here

EDIT:

To address your edit, I know it looks ridiculous but something like this will probably work (using field_school as an example):

[node:field-school:vocabulary]/[node:field-school:parent:parent:name]/[node:field-school:parent:name]/[node:field-school:name]

Here's another screenshot showing the extra data available for term reference fields in pathauto:

enter image description here

9
  • Ive updated my question. Your solution only adds the last term to the url and I have a hierarchical taxonomy structure. Thanks
    – Evanss
    Apr 12, 2012 at 15:15
  • Make sure you've got the Token module installed and have a look at this post, it's got the answer you're looking for :)
    – Clive
    Apr 12, 2012 at 15:23
  • Ive used that answer to get the urls working properly for the terms, however I cant get them working for the nodes. Thanks
    – Evanss
    Apr 12, 2012 at 15:37
  • @jdln I've updated the answer, hope it helps
    – Clive
    Apr 12, 2012 at 15:43
  • [node:field_tax] returns the node's term, but none of the terms parents.
    – Evanss
    Apr 12, 2012 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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