It seems that the search result image, if available, is ignored and not added to the search result. This would be a nice feature to add.
This could be solved by adding the image src in the function
protected function prepareResults(array $items) { ... }
in Search.php and search for any instance of
$item->pagemap->cse_image[0]->src.
Not sure what the best solution is here but for now i have added the following row to the search results array
'image' => isset($item->pagemap->cse_image[0]->src) ? $item->pagemap->cse_image[0]->src : NULL,
to be able to control the markup and manually print the image in the search-result.html.twig
<img src="{{ result.img_src }}" alt="{{ title }}" />
Comments
Comment #3
decipheredWent a different way, more inline with the standard Node search functionality, implementing a `hook_gss_search_result` hook that modules can implement and add data to the extras item on the search results, which is rendered by default in the `search-result.html.twig` template.
Themeability still exists.