grav-plugin-simplesearch icon indicating copy to clipboard operation
grav-plugin-simplesearch copied to clipboard

Req: display custom text when query returns no result

Open awrog opened this issue 5 years ago • 0 comments

I'd like to be able to display a custom message when there is no search-result

Something like (simplesearch_results.html.twig)

{% if query %}
   {% set count = search_results ? search_results.count : 0 %}
   {% if count is same as( 0 ) %}
      {{ "PLUGIN_SIMPLESEARCH.SEARCH_NORESULTS"|t(query|e, count)|raw }}
   {% elseif count is same as( 1 ) %}
      {{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_SINGULAR"|t(query|e)|raw }}
   {% else %}
      {{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_PLURAL"|t(query|e, count)|raw }}
   {% endif %}
% endif %}

awrog avatar Aug 19 '20 12:08 awrog