-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup Travis to run algolia to index content for search. Ref qunitjs/qunitjs.com#151.
- Loading branch information
1 parent
bf82dbf
commit 8c93ef0
Showing
7 changed files
with
172 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: ruby | ||
cache: bundler | ||
script: | ||
- bundle exec jekyll algolia | ||
branches: | ||
only: | ||
- master | ||
- gh-pages | ||
rvm: | ||
- 2.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
source 'https://rubygems.org' | ||
gem 'github-pages', group: :jekyll_plugins | ||
gem 'jekyll-algolia', group: :jekyll_plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div class="aa-input-container"> | ||
<input type="search" id="aa-search-input" class="aa-input-search" placeholder="Search..." name="search" autocomplete="off"> | ||
<svg class="aa-input-icon" viewBox="654 -372 1664 1664"> | ||
<path d="M1806,332c0-123.3-43.8-228.8-131.5-316.5C1586.8-72.2,1481.3-116,1358-116s-228.8,43.8-316.5,131.5 C953.8,103.2,910,208.7,910,332s43.8,228.8,131.5,316.5C1129.2,736.2,1234.7,780,1358,780s228.8-43.8,316.5-131.5 C1762.2,560.8,1806,455.3,1806,332z M2318,1164c0,34.7-12.7,64.7-38,90s-55.3,38-90,38c-36,0-66-12.7-90-38l-343-342 c-119.3,82.7-252.3,124-399,124c-95.3,0-186.5-18.5-273.5-55.5s-162-87-225-150s-113-138-150-225S654,427.3,654,332 s18.5-186.5,55.5-273.5s87-162,150-225s138-113,225-150S1262.7-372,1358-372s186.5,18.5,273.5,55.5s162,87,225,150s113,138,150,225 S2062,236.7,2062,332c0,146.7-41.3,279.7-124,399l343,343C2305.7,1098.7,2318,1128.7,2318,1164z" /> | ||
</svg> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/combine/npm/algoliasearch@3.26.0,npm/autocomplete.js@0.29.0/dist/autocomplete.min.js" defer></script> | ||
<script> | ||
window.addEventListener('DOMContentLoaded', function setupSearch() { | ||
const client = algoliasearch('{{ site.algolia.application_id }}', '{{ site.algolia.search_only_api_key }}'); | ||
const index = client.initIndex('{{ site.algolia.index_name }}'); | ||
const autocompleteOptions = { | ||
hint: false, | ||
debug: true | ||
}; | ||
const autocompleteSources = [ | ||
{ | ||
source: autocomplete.sources.hits(index, { hitsPerPage: 5 }), | ||
displayKey: '', | ||
templates: { | ||
suggestion(suggestion) { | ||
return ` | ||
<a href="${suggestion.url}"> | ||
<p class="aa-suggestion_content">${suggestion._highlightResult.content.value}</p> | ||
<p class="aa-suggestion_meta">${suggestion.title}</p> | ||
</a> | ||
`; | ||
}, | ||
empty(query) { | ||
return `<div class="aa-empty">No results for "${query.query}".</div>`; | ||
} | ||
} | ||
} | ||
]; | ||
autocomplete('#aa-search-input', autocompleteOptions, autocompleteSources) | ||
.on('autocomplete:selected', (event, suggestion) => window.location = suggestion.url); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters