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