Skip to content

Commit

Permalink
Add Algolia DocSearch (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
phrawzty authored and pkuczynski committed Dec 28, 2017
1 parent 509c686 commit 3a08f69
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions content/assets/css/algolia-docsearch.sass
@@ -0,0 +1,5 @@
.algolia-autocomplete .algolia-docsearch-suggestion--category-header
color: maroon

.algolia-autocomplete .algolia-docsearch-suggestion--title
color: #555658
5 changes: 5 additions & 0 deletions layouts/shared/doc_menu.haml
Expand Up @@ -3,6 +3,11 @@
= link_to 'RVM Documentation Index', '/', style: "color: red;"
|
= link_to 'RVM Blog', '/blog/'

.headline
<label for="docsearch-input">Search:</label>
<input id="docsearch-input" type="text" />

.column
= menu_for("/rvm/")

Expand Down
10 changes: 10 additions & 0 deletions layouts/shared/footer.haml
Expand Up @@ -40,3 +40,13 @@
ga('send', 'pageview');
ga('create', 'UA-45354940-1', 'rvm.io', {'name': 'ga_mpapis'}); // owner mpapis@gmail.com
ga('ga_mpapis.send', 'pageview');

:preserve
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
:javascript
docsearch({
apiKey: '511953e6f628103639db56a6f0f96977',
indexName: 'rvm',
inputSelector: '#docsearch-input',
debug: false // Set debug to true if you want to inspect the dropdown
});
2 changes: 2 additions & 0 deletions layouts/shared/html-head.haml
Expand Up @@ -3,6 +3,8 @@
RVM: Ruby Version Manager -
= @item[:title]
%link{ :href => "/css/screen.css", :rel => "stylesheet", :type => "text/css", :media => "screen" }
%link{ :href => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css", :rel => "stylesheet", :type => "text/css" }
%link{ :href => "/css/algolia-docsearch.css", :rel => "stylesheet", :type => "text/css" }
%meta{ :content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }
%meta{ :name => "google-site-verification", :content => "w2V78a6cwiHD5Gm8yvlTP21xZ1YgVguDdC0JGDEA2d0" }
= add_feed_link

0 comments on commit 3a08f69

Please sign in to comment.