Display best bets in a Freemarker results template

If you are accessing the raw JSON or XML to produce your search result template see the best bets data model information.

The following Freemarker code from the default template (simple.ftl) is used to display your best bets.

The default template code formats the set of best bets as a series of list items contained within an ordered list.

This can be easily adapted to suit your display requirements.

<#if curatorAdvertPresent > (1)
  <ol id="search-best-bets" class="list-unstyled">
    <#-- Curator exhibits -->
    <#list response.curator.exhibits as exhibit> (2)
      <#if exhibit.titleHtml?? && exhibit.linkUrl??>
        <li class="alert alert-warning">
          <h4><a href="${exhibit.linkUrl}"><@s.boldicize>${exhibit.titleHtml?no_esc}</@s.boldicize></a></h4>
          <#if exhibit.displayUrl??><cite class="text-success">${exhibit.displayUrl}</cite></#if>
          <#if exhibit.descriptionHtml??><p><@s.boldicize>${exhibit.descriptionHtml?no_esc}</@s.boldicize></p></#if>
1 Checks to see if any curator adverts exist
2 The code contained within this <#list> is applied for each matching best bet.
Older Freemarker templates may include a <@s.BestBets> Freemarker macro. This should be ignored or removed and applies to an old, deprecated, type of best bets that existed prior to Funnelback 15.0.

See also