Using Views with Search Results – Drupal 8

After 9+ years of working with WordPress, I just started out learning Drupal 8. I do have some knowledge of Drupal 7 and wanted to get started with the latest platform.

Recently I was trying to customize the output of the search results in Drupal 8. Setting up Search Pages is quite easy in Drupal 8, but the output is not visually appealing to visitors.

I couldn’t find a good tutorial or guide on how to customize the output using Twig. I did find a way with Views to make this page more presentable:

This was a very neat discovery and I hope you enjoy the brief video tutorial on how to do this.

Keep in mind my daughter decided to do art in the background and you do hear the noise from that 🙂

Let me know if you have a guide on using Twig to create the same results.

STEPS

  1. Create Search Page – /admin/config/search/pages
  2. Create View /admin/structure/views
    1. Add View
    2. Make a view name
    3. Check mark create a page
      1. set path to match the search page url – ie search/node
    4. Save and Edit View
    5. add search keywords to Filter Criteria
      1. Checkbox Expose the filter to visitors and click apply
    6. Under Advanced change expose form in block to yes
    7. Click Save
  3. Go to admin/structure/block click Place Block in a region
  4. Find the exposed form click Place Block
  5. Click Save Blocks

Video Tutorial

Scroll to Top