getgrav / grav-plugin-simplesearch

Grav SimpleSearch Plugin
https://getgrav.org
MIT License
44 stars 55 forks source link

Req: display custom text when query returns no result #191

Open awrog opened 3 years ago

awrog commented 3 years ago

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 %}