I have several paragraphs nested into one content type. Users can add only one type of paragraph. Is it possible to create a url alias pattern based on paragraphs? For instance, I have paragraphs "car", "bike", and "boat" in one content type "garage". If the user adds a "car" paragraph the url alias should be garage/car/etc, and for boat garage/boat/etc etc. Possible? It is generating the same url pattern for now.

  • 1
    Sounds like a better job for taxonomy IMO.
    – Kevin
    Mar 20, 2017 at 13:58

2 Answers 2


Since you mention that you only have a single allowed paragraph, something like [node:paragraph_field:entity:type:target_id] might work, but untested. That will use the machine name of the referenced paragrap type.

If not, you can always implement a custom token on nodes and then do whatever you want using hook_token_info() and hook_tokens().

I also agree with others that this seems like a somewhat strange architecture and usually list/term fields are used for such a categorization, this will most likely also work better if you ever need to do something like an exposed filter in a view and so on.

  • Your suggestion works. Thanks, Berdir! On the architecture: each paragraph has a different set of fields. So the garage is just a "container" content type. It seemed redundant to have a taxonomy just to categorize paragraph types when each paragraphs' machine name is self explanotry. Is this a common practice? What would be the better approach? Paragraphs based exposed filters seem to work with relationships. Not sure which approach is more efficient and performant. Appreciate the insight.
    – JAT
    Mar 21, 2017 at 19:18

With pathauto there are some tokens available for any field of a node, including paragraphs.

I think @Kevin is right though, paragraphs connected with terms.

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.