0

I have a content type that has taxonomy terms for Category, like Blog, Publication, and Project. Depending on which term is selected, the content is displayed under blogs, publications or projects. If the category selected is Project, then the user has to select the focus area from another vocabulary (not a child vocabulary) - Focus Area 1, Focus Area 2... through to Focus Area 10.

Currently, my pathauto pattern displays the Category/Node_Title - [node:field_post_category:entity]/[node:title]

My objective is that I also want to display the Focus Area term in the node url, but ONLY if the category chosen is 'Project'. In that case, I want the url to be project/focus_area_n/node_title. So the focus area is displayed in the node url only if the category is project. Is there a Pathauto pattern, or any other method that I can use to accomplish this?

I need to do this so that I can control the display of a few blocks in the sidebar that will show up depending on what the URL is.

Thanks in advance...

  • You’ll need to code a custom token for that – Clive Jul 5 '18 at 16:41
0

It was actually quite easy! No custom-coding required. I just added the token for the other vocabulary to the URL alias pattern, and it now appears, when it's present. When not present, the regular URL is formed.

So now the new pattern is [node:field_post_category:entity]/[field_focus_area:entity]/[node:title]

Drupal is great!

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.