2

How can I use term id instead of term name in path auto?I have a category field in my content type named "field_article_category" and there is a token [node:field_article_category] for it but it is replaced by term name not term id.is there anyway to get term id instead of term name?

  • 1
    You can select multiple terms during creating a node (if it supports multiple select). For example, if you select 2 terms for one node, you can check one of them by selecting delta. For the first selected term it should be 0, for the second term should be 1 and so on. For first term: [node:field_catalog:0:tid] - taxonomy term it for the first selected term. – Peter Lozovitskiy Mar 17 '13 at 7:01
2

The token you should use for the taxonomy term ID is [node:field_article_category:id].

I have a "Categories" vocabulary, and this is the list of the tokens associated to that vocabulary for the nodes.

screenshot

If you install the Token module, apart from having more tokens available, you will also have a list of the available tokens, from which I have taken the previous screenshot. The list is available after the fields to set the patterns for the automatic aliases, in the "Replacement patterns" fieldset.

screenshot

I have noticed that out of four vocabularies I associated with content types, only two are listed as tokens; in my case, thought, I don't see all the tokens for that vocabulary, which is different from your case, where you seem to see only part of the tokens associated with a vocabulary.

  • If I type "[node:field_category:tid]" I get this error: "The Pattern for all article paths is using the following invalid tokens: [node:field_article_category:tid]". – Nick.h Aug 22 '11 at 0:04
  • Is your screenshot from drupal 7? – Nick.h Aug 22 '11 at 0:05
  • The screenshot is from Drupal 7. – kiamlaluno Aug 22 '11 at 0:56
  • If you are using "[node:field_category:tid]", why is the error for "[node:field_article_category:tid]"? – kiamlaluno Aug 22 '11 at 1:04
  • sorry, it is [node:field_article_category:tid] which causes the error.For article_category I have just one token: [node:field_article_category] which is not expandable – Nick.h Aug 22 '11 at 1:10
3

You likely need the Entity tokens module from http://drupal.org/project/entity for now. We are working on adding the more detailed field tokens into Drupal 7.

  • 1
    Thanks Dave.I installed entity and now just one of the term reference fields(I have 4 term reference fieds) is expandable.why? – Nick.h Aug 22 '11 at 9:59
1

in the 'Automated alias settings' of Pathauto you will find the section 'Taxonomy term paths', there is a sub-section called 'Replacement patterns'. Here you will find several patters. The pattern [tid] is the pattern used to show the unique ID of the taxonomy term.

I hope have understood well your question.

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.