Skip to content

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

Open
@awrog

Description

@awrog

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions