Algolia search update (#2572)
* Search on menu toggle With that change search is performed when requested. Before it was done for each pageview, regardless of the fact if search was used by user or not. * Localize algolia's empty template
This commit is contained in:

committed by
GitHub

parent
91433e72e6
commit
28edd82198
@ -44,11 +44,18 @@ search.addWidget(
|
||||
instantsearch.widgets.hits({
|
||||
container: '.search-hits',
|
||||
templates: {
|
||||
item: hitTemplate
|
||||
item: hitTemplate,
|
||||
empty: '{{ site.data.ui-text[site.locale].search_algolia_no_results | default: "No results" }}',
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// Starting the search
|
||||
search.start();
|
||||
// Starting the search only when toggle is clicked
|
||||
$(document).ready(function () {
|
||||
$(".search__toggle").on("click", function() {
|
||||
if(!search.started) {
|
||||
search.start();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user