getgrav / getgrav/grav-plugin-simplesearch

Req: display custom text when query returns no result

Open
#191 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
46
Forks
55
Avg merge
5h 44m
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with simplesearch_results.html.twig, the template named in the issue, and inspect how query and search_results are currently rendered. Confirm how translation keys are defined in the plugin, then verify that a zero-result query displays the requested custom translated message while existing singular and plural result summaries remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
search
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.