Skip to content

Commit 6728f73

Browse files
committed
search works again
1 parent 1f7ba65 commit 6728f73

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

js/algolia/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { html } from 'htm/preact';
21
import algoliasearch from 'algoliasearch/lite';
32
import { autocomplete, getAlgoliaResults } from '@algolia/autocomplete-js';
43
import {createAlgoliaInsightsPlugin} from '@algolia/autocomplete-plugin-algolia-insights';
@@ -55,17 +54,20 @@ function initAutocomplete(item){
5554
});
5655
},
5756
templates: {
58-
item({ item }){
57+
item({ item, createElement }){
5958
if (item.anchor != null) {
6059
var anchorLink = "#" + item.anchor;
6160
} else {
6261
var anchorLink = "";
6362
}
64-
return html `<a class="aa-link" href="/docs${item.url}${anchorLink}">
65-
<p class="aa-title" >${highlightHit({hit: item, attribute: 'title'})}</h3>
66-
<p class="aa-heading">${item.headings.join(' >')}</p>
67-
<p class="aa-content">${highlightHit({hit: item, attribute: 'content'})}</p></a>
68-
`;
63+
return createElement('div',{
64+
dangerouslySetInnerHTML: {
65+
__html: `<a class="aa-link" href="/docs${item.url}${anchorLink}">
66+
<p class="aa-title" >${highlightHit({hit: item, attribute: 'title'})}</h3>
67+
<p class="aa-heading">${item.headings.join(' >')}</p>
68+
<p class="aa-content">${highlightHit({hit: item, attribute: 'content'})}</p></a>`
69+
}
70+
})
6971
},
7072
noResults() {
7173
return html `<p class="aa-content">No results for <strong>${query}</strong></p>`;

0 commit comments

Comments
 (0)