Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Search Results Template - show image in search results
Hi.
I am using version 7.3.5 GA6.
I am just creating a custom Widget Template (Search Results Template) for search results. I am trying to display an image, but unfortunately unsuccessful. I used the code that is already in Liferay, but it doesn't work either. Below is the code:
<div>
<#if entries?has_content>.
<#list entries as entry>.
<div>
${entry.getThumbnailURLString()}
</div>
</#list>
</#if>
</div>
<#if entries?has_content>.
<#list entries as entry>.
<div>
${entry.getThumbnailURLString()}
</div>
</#list>
</#if>
</div>
Web content contains an image in the "FEATURED IMAGE" section. What exactly do I need to do to make the image appear in the search results?
Hi,
This is abstract image or structure field?
Regards
Sushil
Hi ,
You may need to fetch the image from article object , you can use service locator for fetching the journal article and then use the image .
<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
<#if entries?has_content>
<#list entries as entry>
<img src="${journalArticleLocalService.getLatestArticle(entry.getClassPK()).getArticleImageURL(themeDisplay)}" />
</#list>
</#if>
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™