1

I currently have a pattern set up for my site's basic pages. It pulls in some generic fields associated with the content type, and no problems there.

Got a new requirement to associate some data from a taxonomy term into the URL path. The content type already had an entity reference field to pull in the taxonomy terms, so the user could associate any number of those terms with the content.

My issue is that I can only use the Taxonomy Term's Name field in the Pathauto pattern configuration. I see no way to bring in another field associated with that Taxonomy term. So, for example, the vocabulary Company has a field called field_short_name that I would like to include in the Basic Page's URL.

Example data of what I have:

  • Company taxonomy term
    • Title: ACME Limited Corporation
    • Short Name: ACME
  • Basic Page content:
    • Title: John Doe
    • Entity Reference: ACME Limited Corporation
  • Path Auto:
    • /[node:field_company]/[node:title]

This currently gives me www.example.com/ACME-Limited-Corporation/John-Doe where I really want it to give me www.example.com/ACME/John-Doe.

I hope I'm explaining this in a way that makes sense.

1

If you have a taxonomy vocabulary named company

And you have a taxonomy entity reference on your basic page machine-named field_company

Then the pattern you want in pathauto is:

[node:field_company:entity:field_short_name]/[node:title]

This says, "find the value of field_company on the current node, get it's referenced entity, find the value of field_short_name / the node title"

  • thank you for responding. I tried that pattern, and got an error stating that: Path pattern is using the following invalid tokens: [node:field_company:entity:field_short_name]. Is there some other configuration change I need to make to make this work? – Stan Mar 7 at 13:53
  • Hmm, maybe just double check that the field names in the path pattern match up with your field names? E.g. Do you have a taxonomy called field_company, which itself has a field called field_short_name – 100pic Mar 7 at 22:18

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.