search history item template (search history)

Description

Define a Handlebars template used to display the contents of each item inside the search history box.

Values passed to the template are:

  • searchParams - query parameters to the search url

  • total - total number of search results for given query

  • date - the time difference between the timestamp when the query was searched and current timestamp. This will be converted to human-readable sentences, such as "23 hours ago", "50 seconds ago" etc.

  • query - query term used to get search results

Widget contains predefined Handlebars partial templates that can be used:

  • {{searchParams}} - display {{searchParams}} from data model passed to template

  • {{total}} - display {{total}} from data model passed to template

  • {{date}} - display {{date}} from data model passed to template

  • {{query}} - display {{query}} from data model passed to template

Default value

searchHistoryItem: {
  template: '<a href="?{{searchParams}}">{{query}} <small>({{total}})</small></a> &middot; <span class="text-warning">{{date}}</span>'
}

Examples

searchHistoryItem: {
    template: '<a href="{{redirectUrl}}">{{title}}</a>-<span class="text-info">{{date}}</span><span class="text-muted"> for <b>{{query}}</b></span>'
},