Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
yfanti committed Jun 27, 2024
1 parent 76b8b97 commit dd80819
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/js/vendor/search-algolia.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import docsearch from '@docsearch/js'
import '@docsearch/css'

window.antoraAlgolia = (function () {
const scriptAttrs = document.getElementById('search-script').dataset
const apiKey = scriptAttrs.apiKey
Expand All @@ -10,8 +13,7 @@ window.antoraAlgolia = (function () {
appId: apiId,
indexName: indexName,
container: '#search-input',
searchParameters: { hitsPerPage: 20 },
transformItems: function (items) {},
searchParameters: { sfacetFilters: ['language:en', 'version:1.0.0'] },
autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
}).autocomplete

Expand Down
5 changes: 3 additions & 2 deletions src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<script src="{{{uiRootPath}}}/js/vendor/search-lunr.js" id="search-script" data-base-path="{{or siteRootPath (or site.url siteRootUrl)}}" data-page-path="{{@root.page.url}}"></script>
<script async src="{{uiRootPath}}/../search-index.js"></script>
{{else if (eq env.SEARCH_ENGINE 'algolia')}}
<script src="{{{uiRootPath}}}/js/vendor/docsearch-3.6.0.js"></script>
<script src="{{{uiRootPath}}}/js/vendor/search-algolia.js" id="search-script" data-api-key="{{env.ALGOLIA_API_KEY}}" data-api-id="{{env.ALGOLIA_API_ID}}" data-index-name="{{env.ALGOLIA_INDEX_NAME}}"></script>
{{!-- <script src="{{{uiRootPath}}}/js/vendor/docsearch-3.6.0.js"></script> --}}
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script src="{{{uiRootPath}}}/js/vendor/search-algolia.js" id="search-script" data-api-key="{{env.ALGOLIA_API_KEY}}" data-api-id="{{env.ALGOLIA_APPLICATION_ID}}" data-index-name="{{env.ALGOLIA_INDEX_NAME}}"></script>
{{/if}}
{{/if}}
3 changes: 2 additions & 1 deletion src/partials/head-styles.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{{#if (eq env.SEARCH_ENGINE 'lunr')}}
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/lunr.css">
{{else if (eq env.SEARCH_ENGINE 'algolia')}}
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/docsearch-3.6.0.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3" />
{{!-- <link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/docsearch-3.6.0.css"> --}}
{{/if}}
{{/if}}

0 comments on commit dd80819

Please sign in to comment.