How do I stop a Taxonomy vocabulary's terms being listed multiple times when I group a view's results by Taxonomy term and instead list the content type multiple times under single terms.

For example, this setup...

view configuration with taxonomy terms

Produces this result...

view display (current)

Whereas what I need is it to produce a result like this... (I might have mixed up some of the categories, I did use Paint after all)

enter image description here

To explain the context: I have a view that lists all 'clients' that have registered to us (I have used a custom Content Type 'Client', Node Limit module and custom permissions/roles ('Client') to have a 'Client' node double as a pseudo person/business.

I have used the Taxonomy module to create a 'Clients categories' vocabulary. The terms in this vocabulary categorise Clients, however Clients may exist in more than one category and so a real-life client may check multiple checkboxes of these terms. So I have setup the content type Client's 'Number of Values' as 'Unlimited'.

The view (exported)

$view = new view();
$view->name = 'Clients_index';
$view->description = 'Page view showing all Clients';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Clients Index';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Clients Index';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'domain';
$handler->display->display_options['access']['domains'] = array(
  1 => 0,
  2 => '2',
  3 => '3',
  4 => '4',
$handler->display->display_options['access']['domain_strict'] = 0;
$handler->display->display_options['access']['domain_member'] = 0;
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['style_options']['grouping'] = array(
  0 => array(
    'field' => 'term_node_tid',
    'rendered' => 1,
    'rendered_strip' => 0,
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'Clients' => 'Clients',

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['header'] = FALSE;
/* Header: Global: Text area */
$handler->display->display_options['header']['area']['id'] = 'area';
$handler->display->display_options['header']['area']['table'] = 'views';
$handler->display->display_options['header']['area']['field'] = 'area';
$handler->display->display_options['header']['area']['empty'] = TRUE;
$handler->display->display_options['header']['area']['content'] = '<h2 class="block-title">Clients\' directory</h2>
<p>Welcome to the Clients\' . Here you can find a relevant Client by product category or by name, or search for a specific company using the search box.</p>';
$handler->display->display_options['header']['area']['format'] = 'full_html';
$handler->display->display_options['defaults']['empty'] = FALSE;
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = '<p>To register as a Client, please contact us</p>';
$handler->display->display_options['empty']['area']['format'] = 'full_html';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
/* Field: Content: All taxonomy terms */
$handler->display->display_options['fields']['term_node_tid']['id'] = 'term_node_tid';
$handler->display->display_options['fields']['term_node_tid']['table'] = 'node';
$handler->display->display_options['fields']['term_node_tid']['field'] = 'term_node_tid';
$handler->display->display_options['fields']['term_node_tid']['label'] = '';
$handler->display->display_options['fields']['term_node_tid']['exclude'] = TRUE;
$handler->display->display_options['fields']['term_node_tid']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['term_node_tid']['limit'] = TRUE;
$handler->display->display_options['fields']['term_node_tid']['vocabularies'] = array(
  'Clients_categories' => 'Clients_categories',
  'tags' => 0,
$handler->display->display_options['path'] = 'Clients';
$handler->display->display_options['menu']['type'] = 'normal';
$handler->display->display_options['menu']['title'] = 'Clients';
$handler->display->display_options['menu']['description'] = 'Clients\' directory';
$handler->display->display_options['menu']['weight'] = '-47';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;

2 Answers 2


The answer is from Szerge who posted on drupal.org. I have added one more relevant step.

  1. Create a Content: Taxonomy terms on node relationship (which is well explained in different posts like https://www.drupal.org/project/views/issues/1239278#comment-5515924)
  2. Display a field with the taxonomy term: (term) Taxonomy term: Rendered Taxonomy term (and the field containing the taxonomy terms with MULTIPLE FIELD SETTINGS "Display all values in the same row" unchecked)
  3. Add the (term) Taxonomy term: Name (asc) sort criteria
  4. Lastly, ensure your "Format" format settings for the entire view are grouped in Grouping field Nr.1 according to the taxonomy term: (term) Taxonomy term: Rendered Taxonomy term
  • I've not checked this, but my original answer was a workaround so this is a better first option to check out for future visitors
    – ja_him
    Feb 13, 2019 at 10:05
  • Thank you for setting my answer as the answer, and @kiamlaluno for editing.
    – Mark P
    Feb 14, 2019 at 9:33

So in the end I created a View of Taxonomy terms based on the above requirements, I then (at least first off, to get it done quickly) created a Views template specific to this (and only this) purpose.

In that template I added code after the printing of the terms that loaded the node title by taking the term id from the $row variable. Using db_select() on the taxonomy_index table to get the associated node ids (nid). I then Used $node = node_load($nid) to load the node and get the title $node->title. I have clean URLs and Pathauto installed so I had to hardcode the /clients portion of the required URL and passed $node->title through a Pathauto function pathauto_cleanstring() to create the alias path. Finally I used url() and l() as described in this article.

For the most part I followed this process but it's a very specific implementation so others might not want to follow it as a tutorial.

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.