Add search powered by Algolia
This commit is contained in:
parent
e553a58e6c
commit
6bc3041fe2
7 changed files with 84 additions and 6 deletions
20
source/_includes/javascripts/algolia.html
Normal file
20
source/_includes/javascripts/algolia.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" />
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
docsearch({
|
||||
apiKey: 'ae96d94b201c5444c8a443093edf3efb',
|
||||
indexName: 'home-assistant',
|
||||
inputSelector: '#search',
|
||||
debug: false // Set debug to true if you want to inspect the dropdown
|
||||
});
|
||||
document.querySelector('.search .close').addEventListener('click', function(ev) {
|
||||
ev.preventDefault();
|
||||
document.querySelector('.search-container').style.display = 'none';
|
||||
});
|
||||
document.querySelector('.show-search').addEventListener('click', function(ev) {
|
||||
ev.preventDefault();
|
||||
document.querySelector('.search-container').style.display = 'block';
|
||||
document.getElementById('toggle').checked = false;
|
||||
document.querySelector('.search-container input').focus();
|
||||
});
|
||||
</script>
|
|
@ -5,8 +5,9 @@
|
|||
|
||||
{% include javascripts/google_analytics.html %}
|
||||
{% include javascripts/disqus.html %}
|
||||
{% include javascripts/algolia.html %}
|
||||
|
||||
{% if page.sidebar != false %}
|
||||
{% include javascripts/github.html %}
|
||||
{% include javascripts/delicious.html %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue