Forum

Thread tagged as: Question, Discussion, Blog

Include Thumbnail Image in Search Results

Hi - I have searched the forum and can't seem to find a solution to this question - "Is it possible to include a thumbnail image in the search results listing"?

I found the template search-result.html in folder perch/core/templates/search that contains the following code...

<perch:if exists="result_thumb"><img src="<perch:search id="result_thumb" />"></perch:if>

If I use the <perch:showall /> function in my search results template, I can't find any fields that look like they refer / relate to any image. The search results being listed are blog posts that I know contain images.

Is anyone able to shed any light on if I can show thumbnail images, and if so, how?

Thanks

James Heanly

James Heanly 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does <perch:showall /> list your image URL?

Hi Andrew - I can't seem to find anything related to an image url in the showall output - see below...

ID  Value
perch_page_path /search
url /blog/post.php?s=2017-05-23-why-billionaires-join-gates-giving-pledge
title   WHY BILLIONAIRES JOIN GATES GIVING PLEDGE
excerpt Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit amet odio finibus mauris consequat{...}
key lorem
source  PerchBlog
result_url  /blog/post.php?s=2017-05-23-why-billionaires-join-gates-giving-pledge
result_title    WHY BILLIONAIRES JOIN GATES GIVING PLEDGE
result_excerpt  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit amet odio finibus mauris consequat{...}
result_key  lorem
result_source   PerchBlog
search_key  lorem
paging  false
total   4
number_of_pages 1
total_pages 1
per_page    10
current_page    1
lower_bound 1
upper_bound 4
prev_url    
next_url    
prev_page_number    
next_page_number    
first_page_url  /search.php?q=lorem
last_page_url   /search.php?q=lorem
first_page  true
last_page   true
perch_item_first    true
perch_item_zero_index   0
perch_item_index    1
perch_item_rev_index    4
perch_item_rev_zero_index   3
perch_item_odd  
perch_item_count    4
perch_namespace perch:search