// This is the function to use to display the banner in the custom JSON data (from the Query Rule) // Assuming that the div <div id="algolia-banner"></div> has been added in the template wrapper.phtml function algoliaHookBeforeInstantsearchStart(search) { var wrapper = document.getElementById('algolia-banner'); var widgetConfig = { templates: { allItems({userData}) { if (userData) { const banners = userData.map(({banner_img}) => { return '<img src="https://www.beat-it.nl/media/' + banner_img + '"/>'; }); return banners.join(''); } return ''; }, }, container: wrapper.appendChild(createISWidgetContainer('banner')), }; search.addWidget(algoliaBundle.instantsearch.widgets['hits'](widgetConfig)); return search; }