grav-plugin-simplesearch
grav-plugin-simplesearch copied to clipboard
Simple can't access result page
Hello,
I hope you can help me. I don't have an idea why it's not working.
At my blog site I has a simple search box. http://cboehm.it/blog Category is set to blog.
After press Enter the blog site will be reload but no search result appears. What could be wrong?
Thank you
Same :)
I have the same problem. I noticed that on my non-working installation, whenever I search for something, there is ?searchfield= added at the end of the URL and not /search/query: as per the documentation.
Hey folks,
I had the same Issue and had a look on the forums. That is, where I found a solution. As it seems, simplesearch doesn't include the JS-file (on some themes), so that you have to add it on your own.
For more info check out this forum post: https://discourse.getgrav.org
After I added the JS-file to the footer of my site, the search started working again.
Hope that did help you!
I think we need to run through all the core team's Grav themes and add this empty bottom block to them all. We didn't have the ability of having multiple JS blocks when we wrote most of the themes originally.
As @Heartfyre said, the Javascript file /user/plugins/simplesearch/js/simplesearch.js
may not be loaded.
Solution:
Find the file where the HTML code for the SimpleSearch plugin is loaded. For the afterburner2
theme, the file is user/themes/afterburner2/templates/partials/sidebar.html.twig
.
You will see these lines:
{% if config.plugins.simplesearch.enabled %}
// HTML code
{% endif %}
In this block, and after the HTML code, insert the Javascript file:
{% if config.plugins.simplesearch.enabled %}
// HTML code
<script src="/user/plugins/simplesearch/js/simplesearch.js" type="text/javascript" ></script>
{% endif %}
Then it should work properly.
@dtrecherel Did this, problem not fixed. http://voidmain.xyz still showing up ?searchfield
.
Also, if i was at http://voidmain.xyz/blog , input something to the searchbox, i get this http://voidmain.xyz/blog?searchfield=dwdw
not xxx.com/search/query:xxx . Basic the same question.
@liqimore and @dtrecherel
Adding this line to base.html.twig before the tag </body>
works.
<script src="/user/plugins/simplesearch/js/simplesearch.js" type="text/javascript" ></script>
But now there is the next problem. I search for an query at cboehm.it/blog/. The search result appears at route /blog/search but without any result. (I define this route in the config)
The search only works if I try a query at a higher page. https://cboehm.it/search/query:Leipzig
Whats wrong? There are no more config files...
I have experienced the same problems as above using the Anitmatter theme with Simplesearch installed.
The default configuration has Category filter
default to Blog
. I want Simplesearch to search my entire site, so, I cleared the Category filter
field, in the Admin interface, so Simplesearch would search my entire site and not be limited to searching just Blog
.
What I have found is, when clearing the Category filter
field in the Admin interface, it deletes the entire Category filter
keys and value (Blog) in the config file rather than just deleting the value (Blog). This renders Simplesearch inoperable.
To fix this I put the Category filter
keys back into the config file, manually, and left the value blank. Simplesearch then works perfectly.
Any update on this? Tried all workarounds suggested in the thread, none of them successful.
However, I seemingly managed to get things working by updating /user/plugins/simplesearch/templates/partials/simplesearch_searchbox.html.twig.
From:
<form name="search" data-simplesearch-form>
<input
name="searchfield"
To:
<form name="search" data-simplesearch-form action="search">
<input
name="query"
This changes the query into something that grav seems to understand (/search?query=xxxxx).
Concerning that this plugin seems somewhat broken out of the box.
@AugustGSP You made my day. Now it works.
@AugustGSP Also worked for me. Thank you so much August. Spent 3+ hours trying to fix this. This needs to be fixed in the base install!
Found a problem with this technique though, it 404s when you try and activate the search from any subdirectory, because it tries to append /search from the current page. EG: domain.com/sudirectory/search