How to link to pages in my site from my app.js file

When search results are displayed, I’d like to link to the page on my site where they can get more detail on a result. In my hits widget, I have the following code:

  <div>
    <div class="hit-title">
      <a href="job/{{"attribute": "Id"}}">{{#helpers.highlight}}{ "attribute": "Title" }{{/helpers.highlight}}</a>
    </div>

Where the attribute Id contains the suffix to the URL to get the user to the right place. The outcome I need to achieve is mysite.com/job/{{Id}}

This code doesn’t work. Instead, I just get mysite.com/job without the Id attribute appended. What changes do I need to make to get the attribute appended within the <a> tag?

What templating engine is this?

I’m using Flask/Jinja

I think you should post this in a Flask/Jinja related Forum, because this question is not really related to algolia

Hi Eric, If you are using the instantsearch template, I would suggest using a function for the template such as this:

templates: {
      item(hit) {
          return `
              <div><div class="hit-title">
                   <a href="${hit.id}">${instantsearch.highlight({ attribute: 'Title', hit })}</a>
              </div></div>
        `
      }
}

This assumes that you have an attribute ‘id’ in your record/object.