Skip to content

Commit

Permalink
Improve search
Browse files Browse the repository at this point in the history
Fix issue with special characters
Resolves #191
  • Loading branch information
oodamien committed Nov 15, 2023
1 parent 3cb0605 commit 57d3937
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/js/vendor/search.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

let lastRenderArgs

const decodeHtmlEntities = (str) => {
return str.replaceAll('<', '<').replaceAll('>', '>')
}

const infiniteHits = instantsearch.connectors.connectInfiniteHits((renderArgs, isFirstRender) => {
const { hits, showMore, widgetParams } = renderArgs
const { container } = widgetParams
Expand Down Expand Up @@ -80,14 +84,13 @@
.filter((item) => !!item)
.join(' - ')

console.log(label)
return `<li>
<a href="${hit.url}" class="ais-Hits-item">
<div class="hit-name">
${label}
${decodeHtmlEntities(label)}
</div>
${breadcrumbs}
${content}
${decodeHtmlEntities(breadcrumbs)}
${decodeHtmlEntities(content)}
</a>
</li>`
})
Expand Down

0 comments on commit 57d3937

Please sign in to comment.