The setup:

A Taxonomy Vocabulary called "Area of work".

The vocabulary has the following associated terms: A, B, C, D, E, F, G, etc.

During registration users have to choose a department from the taxonomy list to associate themselves with.

The challenge:

I would like to create a single page view or multiple page views if necessary that displays the users that work in each department.

Another requirement is to display each list of users page using the following the path pattern: people/staff/A/, people/staff/B/...

Current status:

So far, I have managed to create a generic list with all users that have selected one of the departments in the following path: people/staff, but I can't figure out how to display single lists for each department.

Any help will be much appreciated!

  • You could use URL wildcards in your views page URL to retrieve and apply that filter accordingly. It would be just one view.
    – leymannx
    Commented Mar 11, 2019 at 16:59

3 Answers 3


First of all, thank you very much to @leymannx, @GiorgosK and @prkos, because without the three contributions I wouldn't have achieved the desired result.

These are the steps I have followed to display a list of users who have the same taxonomy term in a page with a specific path pattern: people/staff/A/, people/staff/B/...

  1. As @leymannx initially suggested, in my view a wildcard in the path was missing. So, instead of people/staff/, I have changed it to people/staff/%
  2. As @GiorgosK illustrated with his screenshot, I have included a Relationship field_staff_area: Taxonomy term, and then a Contextual filter on Taxonomy term: Name using this relationship.
  3. Finally, as @prkos precisely described, to show the actual term name in the URL I also needed to configure the Contextual as follows:

    a. When the filter value is NOT in the URL: Select the option Display all results for the specified field

    b. When the filter value IS in the URL or a default is provided: Select the option Specify validation criteria. Then, select Taxonomy term name in the dropdown, and, finally, check the vocabulary we intend to use (Areas in my case).

enter image description here

enter image description here


To organize your current list of users according to their Department you can group the results by the Department field.

To do that:

  1. add the Department Field to the Fields list, Exclude from display if you don't need it repeated in the result rows.

    Change Style settings to use the wrapper that makes sense in your case (maybe H2). Style settings set here will be applied to most Format settings, so it will server as sort of a "grouping heading".

  2. then Under Format settings set the Grouping field Nr.1 to the Department field.

This will reorganize the results into groups of people that work under the same Department.

The second question has already been answered by GiorgosK.

You can make Drupal automatically create pages sensitive to the Department in the URL with the help of a Contextual filter. Adding a Taxonomy field Contextual will work but the URL will show the TID number, not the term name.

To show the actual term name in the URL:

  1. you first need to add the Relationship towards the taxonomy term, then you will be able to add the Name Contextual filter.
  2. Then configure the Contextual:
    When the filter value is NOT in the URL
    Display all results for the specified field
    When the filter value IS in the URL or a default is provided
    Specify validation criteria
    Taxonomy term name
    [your vocabulary]
    [Other options that make sense in your case]
  3. Edit the Path to /people/staff/% to tell it which path should be replaced with the Contextual
  4. Optionally you can also Override title and enter the token you can find under Replacement patterns, something like {{ arguments.name }} so when you add the name into the URL the results will be filtered and the title will change accordingly.

Modify the view that you already have that displays all users to include a Relationship field_department: Taxonomy term and Contextual filter on Taxonomy term: Name using this relationship. Here is some details

enter image description here

After that you should be able to visit /people/staff/A or /people/staff/B etc and see the users that have the corresponding term selected.

  • Sorry I didn't explain myself very well. I didn't intend to include the word department before each result. I have updated my question for clarity.
    – ygoex
    Commented Mar 12, 2019 at 12:18
  • @ygoex That requirement was only part of the NOTE which i erased. The solution is still valid, please try it on your own and post any question if you get stuck.
    – GiorgosK
    Commented Mar 12, 2019 at 12:23

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.