Skip to content

Commit

Permalink
brute force revert to check pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cstns committed Oct 10, 2024
1 parent ba3c274 commit bb389b5
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/_includes/layouts/common-js.njk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,72 @@
}
const placeholder = Object.prototype.hasOwnProperty.call(scopeTitles, searchScope) ? `Search in ${scopeTitles[searchScope]}...` : 'Search...'
const searchQuery = (searchClient, query, scope) => {
return {
sourceId : scope,
getItems : () => getAlgoliaResults({
searchClient,
queries: [
{
indexName : 'netlify_00f8cf60-997f-4c4d-9427-a97924358648_live_all',
params : {
query,
hitsPerPage: 5,
},
attributesToHighlight: '*',
filters: scope.length === 0 ? undefined : `category:${scope}`
},
],
}),
templates: {
header({html}) {
if (!Object.prototype.hasOwnProperty.call(scopeTitles, scope)) {
return null;
}
return html`
<span class="aa-SourceHeaderTitle">In ${scopeTitles[scope]}</span>
<div class="aa-SourceHeaderLine"/>
`;
},
item({item, components, html}) {
return html`
<a href="${item.url}" class="aa-ItemWrapper">
<div class="aa-ItemContent">
<div class="aa-ItemIcon aa-ItemIcon--alignTop">
<img
src="${item.image}"
alt="${item.name}"
width="40"
height="40"
/>
</div>
<div class="aa-ItemContentBody">
<div class="aa-ItemContentTitle">
${components.Highlight({
hit : item,
attribute: ['hierarchy', 'lvl0'],
})}
</div>
<div class="aa-ItemContentSubTitle ${item.type === 'lvl0' ? 'hidden' : ''}">
${components.Highlight({
hit : item,
attribute: ['hierarchy', item.type],
})}
</div>
<div class="aa-ItemContentDescription">
${components.Snippet({
hit : item,
attribute: 'description',
})}
</div>
</div>
</div>
</a>`;
},
},
};
}
}
</script>
Expand Down

0 comments on commit bb389b5

Please sign in to comment.