Let's suppose we have a view like news/%. Where news is my content type, and % is tid of term id from vocabulary "categories".

Obviously that urls like news/3, news/5 etc. works great. But how to do the path aliases for this kind of urls, generated from this view?

I want like this:

  • news/% -> company-news/[term:name]
  • Example: news/3 -> company-news/accidents

(where [term:name] transliterated term name from original title, because my site not on english language)

P.s. the just using pathauto for taxonomy terms, and the view "taxonomy/term/%" does not suit, because one term is used by multiple content types, and therefore in multiple views.

1 Answer 1


That is quite a tricky one.

Two possible solutions:

1) Use page manager, create a context for each content type, and then use this module to generate the aliases): https://www.drupal.org/project/page_manager_pathauto (note: no Drupal 8 version)

2) Add/remove/modify the aliases yourself with an update hook. So when a node is updated, you create/update/delete the corresponding path aliases.

  • I'm used advice # 2
    – Viktor
    Mar 31, 2019 at 9:43
  • I'm used advice # 2. I create a custom module for extra path alias creation, where I use hook_ENTITY_TYPE_insert to generate new alias for term, when it was saved. With \Drupal::service('path.alias_storage')->save($origin_path, $new_alias, $entity_language_id);
    – Viktor
    Mar 31, 2019 at 9:46

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.