how ever new algolia docsearch added recently , which will automatically crawler the website and add search index automatically
Feature 1 功能需求 Add algolia docsearch
I want this feature to solve automatic index
Useful reference 有价值的参考
Copy the following CSS/JS snippets and add them to your page
<!-- at the end of the HEAD -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
<!-- at the end of the BODY -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script type="text/javascript">
docsearch({
apiKey: 'd672449370ed94b6bb27a0ad6de65a60',
indexName: 'hugoloveit',
inputSelector: '### REPLACE ME ####',
algoliaOptions: { 'facetFilters': ["lang:$LANG"] },
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
Add a search input in your page if you don't have any yet. Then update the inputSelector value in JS snippet
to a CSS selector that targets your search input field.
Replace $LANG with the lang you want to search on. The list of possible lang is extracted from your website according to the "lang" selector.
So as of today you have: en, fr, zh-cn
For example if you want to refine the search to the lang "en" just specify: 'facetFilters': ["lang:en"]
Describe the feature you want 描述你的功能需求
Currently the search support for algolia, needs to be added by exporting index.json https://hugoloveit.com/theme-documentation-basics/#52-search-configuration
how ever new algolia docsearch added recently , which will automatically crawler the website and add search index automatically
Useful reference 有价值的参考
Add a search input in your page if you don't have any yet. Then update the inputSelector value in JS snippet to a CSS selector that targets your search input field.
Replace $LANG with the lang you want to search on. The list of possible lang is extracted from your website according to the "lang" selector. So as of today you have: en, fr, zh-cn
For example if you want to refine the search to the lang "en" just specify: 'facetFilters': ["lang:en"]
If available, provide useful links to fulfill the feature. 如果可以的话, 提供实现这个功能的相关参考链接.