DocSearch and Sphinx not working together

时间:2019-03-19 14:50:21

标签: javascript python algolia

I am using Sphinx for a documentation website, and decided to integrate with Algolia's DocSearch.

In my layout.html, I included the following:

{% set css_files = css_files + ["https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css", "_static/custom.css"] %}

<!-- Algolia DocSearch Integration -->
<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: '....',
    indexName: 'myIndex',
    inputSelector: 'wy-side-nav-search input[type=text]',
    algoliaOptions: { 'facetFilters': ["version:v1.0"] },
    debug: false // Set debug to true if you want to inspect the dropdown 
  }); 
</script>

At this point I thought I was done, but I am heading to the development version of our docs, and I see nothing.

Question 1: Did I do something wrong with integrating the docs?

Question 2: My DocSearch Playground works fine. Is DocSearch working only on actual live websites? For example, can I not use it on development or on my development deployment?

Question 3: Do I need to disable the Sphinx search functionality for DocSearch to work?

1 个答案:

答案 0 :(得分:0)

第二个问题,your website needs to be publicly available与DocSearch一起使用:

enter image description here