Skip to main content

Sitecore SXA search result count in scriban

Is there a way to read the search results count in a Scriban template in a rendering variant of SearchResult in SXA?

I have a requirement that if the search results count is less than 6 the result should be rendered on the page - otherwise we should be displaying a link so that the user can navigate to a page where we will display all the results.

I decided to achieve it thru Scriban by determining the result count and decide whether to render the search result or link.