I'm currently in the process of templating with Algolia + Hogan. But I'm constantly running into the following errors, I'm running Algolia on CraftCMS.
<script>
var hitTemplate = Hogan.compile($('#hit-template').text());
const search = instantsearch({
appId: '{{ craft.searchPlus.getAlgoliaApplicationId }}',
apiKey: '{{ craft.searchPlus.getAlgoliaSearchApiKey }}',
indexName: 'products',
urlSync: true
});
search.addWidget(
instantsearch.widgets.hits({
container: '#hits',
templates: {
empty: 'No results',
item: hitTemplate
},
hitsPerPage: 6
})
);
search.start();
</script>
And this is my hit template. Raw because CraftCMS throws up errors from the .
{% raw %}
<script type="text/template" id="hit-template">
{{#hits}}
<li>
<h4><a href="{{ absoluteUri }}">{{ title }}</a></h4>
{{{ description }}}
<p>{{#productImage}}</p>
<img src="{{ url }}"/>
{{/productImage}}
</li>
{{/hits}}
</script>
{% endraw %}
Getting the following errors through Console.
Warning: Failed prop type: Invalid prop
templates.item
supplied tot
.Template.js:117 Uncaught Error: Template must be 'string' or 'function', was 'object' (key: item)