upgrade theme

This commit is contained in:
⧉ infominer 2023-02-10 04:44:06 -05:00
parent b14c47352e
commit d68502a8d9
58 changed files with 640 additions and 646 deletions

View file

@ -19,8 +19,9 @@ const search = instantsearch({
const hitTemplate = function(hit) {
const url = hit.url;
const title = hit._highlightResult.title.value;
const content = hit._highlightResult.html.value;
const hightlight = hit._highlightResult;
const title = hightlight.title && hightlight.title.value || "";
const content = hightlight.html && hightlight.html.value || "";
return `
<div class="list__item">
@ -44,11 +45,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>