Site Search Results Page

Is there a way for the site search results to render a small image from a custom module? Specifically if searching for an employee we want the small thumbnail image to appear.

Hi @Sue
Yes, this can be done.
The search layout (by default) uses one of the Page module’s layouts. So you can edit this layout by going to ‘Pages’ > “Edit Settings” > ‘Layouts’ > “Site Search Layout”.

But note; this essentially is a shared layout. So any Liquid tags here will be used for all types of module items returned in the site search. So if you are placing a Custom Module specific property in this layout you may want to set a conditional statement to only show that property when it’s the appropriate module.

You could do this like so:

{% if this.Module_Alias == "YourModuleAliasName" %}
    <!-- SHOW YOUR IMAGE -->
    <img src="{{this['YourImageField']}}" alt="{{this['Name']}}">
{% endif %}
1 Like