Forum

Thread tagged as: Question

Include image in search result

Is it possible to include an image in search result?

Thanks

Edward Johansen

Edward Johansen 0 points

  • 3 months ago
Drew McLellan

Drew McLellan 2617 points
Perch Support

From some content sources, yes. Do you see the field you need using <perch:showall> ?

From the search page result?

Drew McLellan

Drew McLellan 2617 points
Perch Support

Yes, presuming that's where you want to show the image.

like the one below?

<perch:if exists="my-thumb"><img src="<perch:search id="my-thumb" />"></perch:if>
Drew McLellan

Drew McLellan 2617 points
Perch Support

Possibly - although that's an invalid ID. Do you see the ID you're looking for with <perch:showall> ?

The image source for the page showing in the result is not showing. I can only see these:

domain  https://mysite.com
url /destinations/palawan/taraw-cliff
sharing_image   /assets/images/footer.jpg
perch_page_path /search
title   Taraw Cliff
excerpt overseas, mainly to China. Nowadays, you can still climb the Taraw Cliff to get an amazing view on{...}
pageTitle   Taraw Cliff
pageNavText Taraw Cliff
source  PerchContent
region_key  Subpages left content
result_url  /destinations/palawan/taraw-cliff
result_title    Taraw Cliff
result_excerpt  overseas, mainly to China. Nowadays, you can still climb the Taraw Cliff to get an amazing view on{...}
result_pageTitle    Taraw Cliff
result_pageNavText  Taraw Cliff
result_source   PerchContent
result_region_key   Subpages left content
search_key  taraw
key taraw
_id 120

The image I want to include is also inside a block.

Robert Ketter

Robert Ketter 99 points
Registered Developer

Edward. You need to add the following tag to your template which will display all the data available to perch at time of template output.

<perch:show all />

Here is some documentation: https://docs.grabaperch.com/templates/show-all/

I already did, but here it is again.

ID                                             Value
domain                                     https://www.mysite.com
url                                            /destinations/palawan/siete-pecados
sharing_image                     /assets/images/footer.jpg
perch_page_path                  /search
title                                             Siete Pecados
excerpt                                 snorkeling experience, thanks to a site there called Siete Pecados. How to get there siete pecados{...}
pageTitle                                   Siete Pecados
pageNavText                         Siete Pecados
source                                  PerchContent
region_key                          Subpages left content
result_url                                  /destinations/palawan/siete-pecados
result_title                           Siete Pecados
result_excerpt                         snorkeling experience, thanks to a site there called Siete Pecados. How to get there siete pecados{...}
result_pageTitle                   Siete Pecados
result_pageNavText         Siete Pecados
result_source                         PerchContent
result_region_key                Subpages left content
search_key                       siete
key                                      siete
_id                                      92                
_blocks               Array
                      (
                      [0] => Array
                      (
                      [SectionBg] => #ffffff
                      [SectionCotentIcon] => icon-icons8-info
                      [_title] => icon-icons8-info
                      [DetSpTwoColumnTextContent] => Array
                      (
                      [_flang] => markdown
                      [raw] => ## About

                      Being an archipelago, the Philippines prides itself of having one of the most diverse marine life on the planet. And it is for this reason that foreign tourists have been flocking to the country, wanting to discover what the Philippines’ underwater life has to offer.

                      In the northern part of the province of Palawan, a rural town called Coron stands out as among the best snorkeling sites in the country. Famous for its magnificent limestone formation, it is also in Coron where one can have an unforgettable snorkeling experience, thanks to a site there called Siete Pecados.
                      [processed] => 
                      (this goes on...)

result_result_url                            /destinations/palawan/siete-pecados
result_result_title                         Siete Pecados
result_result_excerpt                   snorkeling experience, thanks to a site there called Siete Pecados. How to get there siete pecados{...}
result_result_pageTitle                 Siete Pecados
result_result_pageNavText           Siete Pecados
result_result_source                    PerchContent_SearchHandler
result_result_region_key                   Subpages left content
result_search_key                          siete
result_key                                  siete
result__id                                       92     

paging                                       false
total                                               1
number_of_pages                     1
total_pages                             1
per_page                                        10
current_page                                1
lower_bound                             1
upper_bound                             1
prev_url    
next_url    
prev_page_number    
next_page_number    
first_page_url            /search?q=siete
last_page_url               /search?q=siete
first_page                true
last_page                   true
perch_item_first            true
perch_item_last           true
perch_item_zero_index        0
perch_item_index             1
perch_item_rev_index         1
perch_item_rev_zero_index    0
perch_item_odd  
perch_item_count              1
perch_index_in_set          1
perch_zero_index_in_set     0
perch_first_in_set          true
perch_last_in_set             true
perch_namespace             perch:search

Anyone?

Drew McLellan

Drew McLellan 2617 points
Perch Support

Is it one of the images listed there? If so you can use it. If it's not there then it's not available.

The image ID does not show if it's inside a BLOCK. Any way around this? THanks

Drew McLellan

Drew McLellan 2617 points
Perch Support

No, if the image is core to the content item, then it should be outside of a block.