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