SimpleSearch stopped working after 1.10.2->1.13.0 update


Running Grav 1.3.2
After update no results page is shown, only URL changes:
With 10.0.2 URL = /search/query:bla Content is list of results
With 1.13.0: URL = /?searchfield=bla Content is unchanged

/search/ is accessible and manual search via URL editing works.

Rendered HTMl for searchbox:

<div class="searchbox"> <div class="search-wrapper"> <form name="search" data-simplesearch-form> <input name="searchfield" class="search-input" type="text" min="3" required placeholder="Search..." value="" data-search-invalid="Please add at least 3 characters" data-search-separator=":" data-search-input="/grav/search/query" /> <button type="submit" class="search-submit"> <img src="/grav/user/plugins/simplesearch/assets/search.svg" /> </button> </form> </div> </div>


shouldn’t it be:



Yes. I can test that by editing the URL.

The searchbox code (user/plugins/simplesearch/templates/partials/simplesearchbox.html.twig) changed.

(Sorry the forum software does not let me post the code).

Is “data-search-input” used at all in the new version?


Could it be that simplesearch.js is not loaded?


Do you have a custom override for anything? Simplesearch is working fine for me in my testing environment. However, I think that during this time we moved to a pure-JS implementation.


I had the same problem. The simplesearch JavaScript was not added.

I did it in the theme at the bottom of the base.html.twig file with this line as a workaround :
<script type='text/javascript' src='{{ url('plugin://simplesearch/js/simplesearch.js') }}'></script>


I used: {% do assets.addJs('plugin://simplesearch/js/simplesearch.js') %}
Your proposal has the same effect: I can see the script in the source and clicking the path shows the JS source.
Still, search does not work.

Andy, I have a simplified simplesearch_item.html.twig. Otherwise the plugin pages are unchanged.
I use my own theme derived from Learn2.


So, you still get this URL : ‘/?searchfield=bla’ when searching ?


Yes. URL is unchanged.


Did you paste the JavaScript tag in the header or in the footer ?

If i paste it in the header it does not work for me either.


You are correct. It works if I put your code snippet at the end just before /body


Good to hear that it works. :grinning:


I have the same issue with the “Prime” theme which have some changes and renards workaraund (thank you!) helped me to fix it.


I’m confused. I have tried to check how SimpleSearch plugin work in the last demo of Pinpress Skeleton and it works good, but with ?searchfield=something, not with /search?query=something. In my case - if i use SimpleSearch plugin as is - it don’t work and url ends with ?searchfield=something. But if i use workaround from above - it works good but with /search.


Hi @underr,

I had a short look at the Pinpress Skeleton. As far as I can see the search does not work in this theme because of the missing JavaScript.

I digged a bit deeper into this and found out that this line before the closing body tag of the base.html.twig file should add the JavaScript tag : {{ assets.js('bottom') }}
So, the workaround is not needed anymore.

This is already described here : .


I also stumbled across the ?searchfield=something vs. ?query:something issue. GRAV version is 1.3.2, simplesearch version is 1.13.0 and I am using own templates based on grav-skeleton-blog-site 1.3.1. If I use the search template from simplesearch, it generates the ?query:something URL:

data-search-input="{{ base_url }}{{ config.plugins.simplesearch.route == '@self' ? '' : (config.plugins.simplesearch.route == '/' ? '' : config.plugins.simplesearch.route) }}/query"

But it still didn’t work with my browser (Chrome 38.0.2125.122). Yes it’s an old browser, so YMMV, but I want downward compatibility of my website.

I had to change the Javascript included by the simplesearch plugin from:

var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]');
fields.forEach(function(field) {


    document.querySelectorAll('input[name="searchfield"]'), function(field) {

to make it work (forEach loops over arrays, but not DOM objects in older browsers).

In order to be able to substitute the Javascript for simplesearch’s built-in, I needed to modify simplesearch.php to not use its built-in JS, so I suppress it if built-in CSS is disabled (yes, I know that I shouldn’t modify standard files, but I found no other way to avoid editing the built-in Javascript and I already spent hours tracking down this bug or at least incompatibility with my Chrome version):

I changed simplesearch/simplesearch.php, line 294 from:

 if ($this->config->get('plugins.simplesearch.built_in_css')) {

$this->grav['assets']->addJs('plugin://simplesearch/js/simplesearch.js', [ 'group' => 'bottom' ]);


if ($this->config->get('plugins.simplesearch.built_in_css')) {
    $this->grav['assets']->addJs('plugin://simplesearch/js/simplesearch.js', [ 'group' => 'bottom' ]);

and did include my own JS with the Asset Manager.

No it works with the results being filtered on the blog listing page and also with a separate result page using the ?query:something syntax used in simplesearch templates.


So I should add:
{% block bottom %}
{{ assets.js(‘bottom’) }}
{% endblock %}
to my base.html.twig?


Hi @stewag,

if you want to override or change your JavaScript somewhere in your theme use the code you mentioned above.
Otherwise the {{ assets.js(‘bottom’) }} should be enough.