[fix] algoliasearch is not defined (#542)

This commit is contained in:
星日语 2024-11-19 15:43:35 +08:00 committed by GitHub
parent beb5f3d348
commit 6259ac8e98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 78 additions and 76 deletions

View File

@ -202,6 +202,7 @@ search:
appId:
apiKey:
indexName:
js: https://gcore.jsdelivr.net/algoliasearch/3/algoliasearch.min.js
######## Comments ########

View File

@ -4,10 +4,9 @@
appId: '<%- conf.appId %>',
apiKey: '<%- conf.apiKey %>',
indexName: '<%- conf.indexName %>',
js: '<%- conf.js %>',
hitsPerPage: 100,
};
utils.js('https://gcore.jsdelivr.net/algoliasearch/3/algoliasearch.min.js', { defer: true });
utils.js('/js/search/algolia-search.js', { defer: true });
});
</script>

View File

@ -1,3 +1,4 @@
utils.js(window.searchConfig.js).then(() => {
utils.jq(() => {
var $inputArea = $("input#search-input");
if ($inputArea.length === 0) {
@ -73,3 +74,4 @@ utils.jq(() => {
observer.observe($resultArea[0], { childList: true });
});
});