We are using the Supra theme but the the Search Box (displayed on pages) does not come up with a list of results. However the Search Results Box (displayed on the Serach Results page does.
This problem has been mentioned before but we cannot get the suggested methods to work (maybe because we do not know the exact file for {{ assets.js(‘bottom’) }} ):
A aummary of the problem:
-
Home page: search button brings up the Search Box but entering (say) XLP results only in the address bar changing from ‘oursite.com’ to ‘OURSITE.COM’.
-
URL: entering ‘oursite.com/search?query=XLP’ in the address bar brings up Search Results page.
-
Search Results page: entering ‘LTSA’ in the Search Results box brings up the Search Reults and displays ‘oursite.com/search/query:LTSA’ in the address bar - behaves as expected.
Search Box ‘simplesearch_searchbox.html.twig’ is included in:
A. Supra search particle: [DOES NOT WORK]
<
{% extends ‘@nucleus/partials/particle.html.twig’ %}
{% block particle %}
<div class="g-search {{ particle.class|e }}">
<a href="#g-search-{{ id }}" data-rel="lightcase" title="{{ particle.title }}"><i class="fa fa-search" aria-hidden="true"></i></a>
<div id="g-search-{{ id }}" class="g-search-lightcase">
{% if gantry.platform.name == "joomla" %}
<form action="{{ gantry.siteUrl() }}/index.php/component/search/" method="post">
<input type="text" name="searchword" placeholder="{{ particle.placeholder|default('Your keyword...') }}" size="30" maxlength="300" value="">
</form>
{% elseif gantry.platform.name == "wordpress" %}
<form method="get" action="{{ gantry.siteUrl() }}" role="search">
<input type="search" placeholder="{{ particle.placeholder|default('Your keyword...') }}" value="" name="s" title="Search">
</form>
{% elseif gantry.platform.name == "grav" %}
<h2 style="color:#1ebcd3;">Search</h2>
{% include 'partials/simplesearch_searchbox.html.twig' %}
{% endif %}
</div>
</div>
{% endblock %}
{% block javascript_footer %}
{% do gantry.load('jquery') %}
{% do gantry.load('lightcase.init') %}
{{ assets.js(‘bottom’) }}
{% endblock %}
>
B. ‘themes/rt_supra/particles/search.html.twig’ [WORKS]
<
{% extends ‘partials/simplesearch_base.html.twig’ %}
{% block content %}
<div class="content-padding simplesearch">
<h1 class="search-header">{{"PLUGIN_SIMPLESEARCH.SEARCH_RESULTS"|t}}</h1>
<div class="center">
{% include 'partials/simplesearch_searchbox.html.twig' %}
</div>
<p>
{% if query %}
{% set count = search_results ? search_results.count : 0 %}
{% if count == 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 %}
</p>
{% for page in search_results %}
{% include 'partials/simplesearch_item.html.twig' with {'page':page} %}
{% endfor %}
</div>
{% endblock %}
>
simplesearch_searchbox.html.twig [COMMON]
{% set min_chars = config.get('plugins.simplesearch.min_query_length', 3) %}
<div class="search-wrapper">
<form name="search" data-simplesearch-form>
<input
name= "searchfield"
class="search-input"
type="text"
{% if min_chars > 0 %} min="{{- min_chars -}}" {% endif %}
required
placeholder="{{"PLUGIN_SIMPLESEARCH.SEARCH_PLACEHOLDER"|t}}"
value="{{ query|e }}"
data-search-invalid="{{ "PLUGIN_SIMPLESEARCH.SEARCH_FIELD_MINIMUM_CHARACTERS"|t(min_chars)|raw }}"
data-search-separator="{{ config.system.param_sep }}"
data-search-input="{{ base_url }}{{ config.plugins.simplesearch.route == '@self' ? '' : (config.plugins.simplesearch.route == '/' ? '' : config.plugins.simplesearch.route) }}/query"
/>
{% if config.plugins.simplesearch.display_button %}
<button type="submit" class="/grav-site/search-submit">
<img src="{{ url('plugin://simplesearch/assets/search.svg') }}" />
</button>
{% endif %}
</form>
</div>
{{ assets.js(‘bottom’) }}
Can anyone see why Search Results would get results but not Search Box?