Insert URLs in InstantSearch

Hi all,

I’m new to Algolia, and hope that someone can point me to the appropriate resource.

I saw the Instant Search demo [1] and noticed that the search results were not clickable. I checked on GitHub and see that the data source includes URLs [2]. My guess is the template does not have a variable enabled so the names or images are clickable. This version of the Instant Search appears to run on flat file system [3]. Is my understanding correct?

If yes, I would appreciate if someone could point me to a tutorial or the place in the documentation that could provide guidance on how to include the clickable URLs from the data. Thanks!

[1] https://preview.algolia.com/instantsearch/
[2] https://github.com/algolia/instant-search-demo/tree/master/dataset_import
[3] https://github.com/algolia/instant-search-demo

The whole idea is to add a link (<a href="your-link">) tag to the code of the template of the hit widget.
Use the same syntax as for other attributes and you’re good to go.

Example:

<div class="hit">
  <a href="{{url}}">{{{_highlightResult.title.value}}}</a>
  {{description}}
</div>

Thanks! That helped!

1 Like