0

I am trying to implement Algolia into Craft 3 and am having a few headaches.

I am using scout to update my indexes which seems to be working as expected and am using the instantsearch.js implementation of Algolia.

I am getting stuck at the templating part and I want to output HTML that includes fields from my Algolia index and fields from craft.

My template looks like the below so far

 templates: {
  item:`<article class="">
    <p class="spaced-caps-dark-blue no-margin-top">Professional</p>
    <h5 itemprop="headline" class="link-text-large"><a href="{{ url }}">{{ title }}</a></h5>
     <i class="far fa-eye"> {{ entry.totalViews }}</i>   {% set starsRating  = {{entry.rating}} %}
 </article>`,

And I am getting my title and URL from algolia as expected but is it possible to return field values from Craft as well? I want to get my totalViews and rating values from craft as it would quickly ramp up my number of operations in Algolia if I constantly update these values through scout.

I have looked at the Algolia plugin but need more help then the documentation provides and there isn't much information availble via Google on using algoolia with Craft CMS.

Many thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.