I'm building a site for a client and they would like to have a search results page that displays taxonomy terms on matched search results.

I've created a custom theme and was editing templates/dataset/item-list.html.twig to get this data to display.

I also created:

function my_template_preprocess_item_list(&$variables)
    foreach ($variables['items'] as $item) {
        // do something here

But I'm not sure what I should be doing here. Ideally, what I would like to do is have a section on the search results page that displays the matched taxonomy terms and the number of times each term appears in the search results.

Tomorrow's problem is making those taxonomy terms into links that further filters the search results.

I'm running drupal 8.

  • Are you looking for Facets? drupal.org/project/facets – 4k4 Feb 21 '17 at 22:00
  • Maybe? There's no documentation for that module unfortunately so it's difficult to determine what all it can do. – lokisapocalypse Feb 22 '17 at 18:32
  • I ended up abandoning Drupal 8 and going with a Drupal 7 install which allowed me to use Facets as mentioned. – lokisapocalypse Feb 23 '17 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.