I'm trying to create a pathauto rule using tokens which uses a single (the first or whatever) value from a multi-value taxonomy field when creating an alias for a node or taxonomy term.

At the moment, [node:field_name] or [term:field_name] is working fine and producing a desirable alias when there is only one taxonomy term stored in the node or taxonomy term's taxonomy field, however when the node or term is tagged with multiple taxonomy terms, the token returns a concatenated string of all the terms.

Is there any way or token which would allow me to use just one of the terms in the aliases? I've tried looking through the various related issues but have struggled to find a solution.

Any help would be much appreciated!

Comments

samw’s picture

Status: Active » Closed (works as designed)

I seem to be able to achieve this now using the tokens provided by the dev version of Entity Tokens.

Antonín Slejška’s picture

I need to add a meta tag to my site, which will look like:
<meta property="og:image" content="http://www.mysite.cz/.../image.jpg" />
I use the following token: [node:field_photo]
The field_photo stores multiple images, so the output is:
<meta property="og:image" content="http://www.mysite.cz/.../image1.jpg, http://www.mysite.cz/.../image2.jpg, http://www.mysite.cz/.../image3.jpg,..." />
How can I add only the first value to the output?

ReBa’s picture

I would like to use a similar function to what you are asking. Have you found a proper solution to this issue already Antonin?

Antonín Slejška’s picture

The problem was in the module "Metatag". I used this fix.